Commit 47ee7845 authored by hybrid's avatar hybrid

Add new triangle3d method, suggested by rogerborg. Fix comment. Fix type in multiplication.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2859 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 02b5e406
......@@ -60,8 +60,8 @@ public:
an IMetaTriangleSelector) this this function may be called multiple
times to retrieve all triangles.
Please note that unoptimized triangle selectors also may return
triangles which are not in the specified box at all.
This method will return at least the triangles that intersect the box,
but may return other triangles as well.
\param triangles: Array where the resulting triangles will be written
to.
\param arraySize: Size of the target array.
......
......@@ -48,6 +48,20 @@ namespace core
box.isPointInside(pointC));
}
//! Determines if the triangle is totally outside a bounding box.
/** \param box Box to check.
\return True if triangle is outside the box, otherwise false. */
bool isTotalOutsideBox(const aabbox3d<T>& box) const
{
return ((pointA.X > box.MaxEdge.X && pointB.X > box.MaxEdge.X && pointC.X > box.MaxEdge.X) ||
(pointA.Y > box.MaxEdge.Y && pointB.Y > box.MaxEdge.Y && pointC.Y > box.MaxEdge.Y) ||
(pointA.Z > box.MaxEdge.Z && pointB.Z > box.MaxEdge.Z && pointC.Z > box.MaxEdge.Z) ||
(pointA.X < box.MinEdge.X && pointB.X < box.MinEdge.X && pointC.X < box.MinEdge.X) ||
(pointA.Y < box.MinEdge.Y && pointB.Y < box.MinEdge.Y && pointC.Y < box.MinEdge.Y) ||
(pointA.Z < box.MinEdge.Z && pointB.Z < box.MinEdge.Z && pointC.Z < box.MinEdge.Z));
}
//! Get the closest point on a triangle to a point on the same plane.
/** \param p Point which must be on the same plane as the triangle.
\return The closest point of the triangle */
......
......@@ -161,9 +161,9 @@ namespace core
//! Inverts the vector.
vector3d<T>& invert()
{
X *= -1.0f;
Y *= -1.0f;
Z *= -1.0f;
X *= -1;
Y *= -1;
Z *= -1;
return *this;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment