irr: aabbox intersection support
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13465 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4ac3f6f728
commit
04d5903f57
@ -7,3 +7,4 @@ The following changes have been made:
|
||||
- skies respect Z
|
||||
- partial backport to expose setCurrentRendertime in the scene mgr
|
||||
- a workaround for every other RTTs flipping
|
||||
- aabbox intersection support
|
||||
|
@ -245,6 +245,25 @@ class aabbox3d
|
||||
(T)(line.getLength() * 0.5));
|
||||
}
|
||||
|
||||
//! Returns the intersection of this box with another, if possible.
|
||||
aabbox3d<T> intersect(const aabbox3d<T>& other) const
|
||||
{
|
||||
aabbox3d<T> out;
|
||||
|
||||
if (!intersectsWithBox(other))
|
||||
return out;
|
||||
|
||||
out.MaxEdge.X = min_(MaxEdge.X, other.MaxEdge.X);
|
||||
out.MaxEdge.Y = min_(MaxEdge.Y, other.MaxEdge.Y);
|
||||
out.MaxEdge.Z = min_(MaxEdge.Z, other.MaxEdge.Z);
|
||||
|
||||
out.MinEdge.X = max_(MinEdge.X, other.MinEdge.X);
|
||||
out.MinEdge.Y = max_(MinEdge.Y, other.MinEdge.Y);
|
||||
out.MinEdge.Z = max_(MinEdge.Z, other.MinEdge.Z);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
//! Tests if the box intersects with a line
|
||||
/** \param linemiddle Center of the line.
|
||||
\param linevect Vector of the line.
|
||||
|
Loading…
Reference in New Issue
Block a user