5 #ifndef __IRR_TRIANGLE_3D_H_INCLUDED__
6 #define __IRR_TRIANGLE_3D_H_INCLUDED__
38 return !(*
this==other);
79 return d1 < d3 ? rab : rca;
81 return d2 < d3 ? rbc : rca;
95 return (isOnSameSide(pf64, af64, bf64, cf64) &&
96 isOnSameSide(pf64, bf64, af64, cf64) &&
97 isOnSameSide(pf64, cf64, af64, bf64));
121 const f64 invDenom = 1/(dotAA * dotBB - dotAB * dotAB);
122 const f64 u = (dotBB * dotAC - dotAB * dotBC) * invDenom;
123 const f64 v = (dotAA * dotBC - dotAB * dotAC ) * invDenom;
186 f64 d = trianglef64.
pointA.dotProduct(normalf64);
188 outIntersectionf64 = linePointf64 + (lineVectf64 * t);
190 outIntersection.
X = (T)outIntersectionf64.
X;
191 outIntersection.
Y = (T)outIntersectionf64.
Y;
192 outIntersection.
Z = (T)outIntersectionf64.
Z;
264 return (res >= 0.0f);
Axis aligned bounding box in 3d dimensional space.
vector3d< T > MaxEdge
The far edge.
vector3d< T > MinEdge
The near edge.
bool isPointInside(const vector3d< T > &p) const
Determines if a point is within this box.
3D line between two points with intersection methods.
vector3d< T > getClosestPoint(const vector3d< T > &point) const
Get the closest point on this line to a point.
vector3d< T > start
Start point of line.
vector3d< T > getVector() const
Get vector of line.
vector3d< T > end
End point of line.
Template plane class with some intersection testing methods.
3d triangle template class for doing collision detection and other things.
core::vector3d< T > closestPointOnTriangle(const core::vector3d< T > &p) const
Get the closest point on a triangle to a point on the same plane.
bool getIntersectionWithLimitedLine(const line3d< T > &line, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
triangle3d()
Constructor for an all 0 triangle.
triangle3d(vector3d< T > v1, vector3d< T > v2, vector3d< T > v3)
Constructor for triangle with given three vertices.
bool getIntersectionWithLine(const vector3d< T > &linePoint, const vector3d< T > &lineVect, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
plane3d< T > getPlane() const
Get the plane of this triangle.
bool getIntersectionOfPlaneWithLine(const vector3d< T > &linePoint, const vector3d< T > &lineVect, vector3d< T > &outIntersection) const
Calculates the intersection between a 3d line and the plane the triangle is on.
bool isPointInsideFast(const vector3d< T > &p) const
Check if a point is inside the triangle (border-points count also as inside)
bool operator!=(const triangle3d< T > &other) const
Inequality operator.
bool isTotalInsideBox(const aabbox3d< T > &box) const
Determines if the triangle is totally inside a bounding box.
bool isFrontFacing(const vector3d< T > &lookDirection) const
Test if the triangle would be front or backfacing from any point.
bool operator==(const triangle3d< T > &other) const
Equality operator.
bool isPointInside(const vector3d< T > &p) const
Check if a point is inside the triangle (border-points count also as inside)
bool isTotalOutsideBox(const aabbox3d< T > &box) const
Determines if the triangle is totally outside a bounding box.
vector3d< T > pointA
the three points of the triangle
void set(const core::vector3d< T > &a, const core::vector3d< T > &b, const core::vector3d< T > &c)
sets the triangle's points
vector3d< T > getNormal() const
Get the normal of the triangle.
T getArea() const
Get the area of the triangle.
3d vector template class with lots of operators and methods.
vector3d< T > & normalize()
Normalizes the vector.
vector3d< T > crossProduct(const vector3d< T > &p) const
Calculates the cross product with another vector.
T X
X coordinate of the vector.
T getDistanceFrom(const vector3d< T > &other) const
Get distance from another point.
bool isBetweenPoints(const vector3d< T > &begin, const vector3d< T > &end) const
Returns if this vector interpreted as a point is on a line between two other points.
T Z
Z coordinate of the vector.
T dotProduct(const vector3d< T > &other) const
Get the dot product with another vector.
T Y
Y coordinate of the vector.
#define F32_LOWER_EQUAL_0(n)
triangle3d< f32 > triangle3df
Typedef for a f32 3d triangle.
triangle3d< s32 > triangle3di
Typedef for an integer 3d triangle.
const f32 ROUNDING_ERROR_f32
bool iszero(const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals zero, taking rounding errors into account
Everything in the Irrlicht Engine can be found in this namespace.
float f32
32 bit floating point variable.
double f64
64 bit floating point variable.