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);
bool isTotalInsideBox(const aabbox3d< T > &box) const
Determines if the triangle is totally inside a bounding box.
vector3d< T > MaxEdge
The far edge.
T Y
Y coordinate of the vector.
bool iszero(const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals zero, taking rounding errors into account
bool isPointInside(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.
float f32
32 bit floating point variable.
plane3d< T > getPlane() const
Get the plane of this triangle.
vector3d< T > getVector() const
Get vector of line.
triangle3d()
Constructor for an all 0 triangle.
3d triangle template class for doing collision detection and other things.
T X
X coordinate of the vector.
bool operator==(const triangle3d< T > &other) const
Equality operator.
Everything in the Irrlicht Engine can be found in this namespace.
triangle3d< f32 > triangle3df
Typedef for a f32 3d triangle.
3d vector template class with lots of operators and methods.
3D line between two points with intersection methods.
double f64
64 bit floating point variable.
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.
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.
vector3d< T > crossProduct(const vector3d< T > &p) const
Calculates the cross product with another vector.
bool getIntersectionWithLimitedLine(const line3d< T > &line, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
bool isFrontFacing(const vector3d< T > &lookDirection) const
Test if the triangle would be front or backfacing from any point.
vector3d< T > pointA
the three points of the triangle
const f32 ROUNDING_ERROR_f32
vector3d< T > end
End point of line.
T getDistanceFrom(const vector3d< T > &other) const
Get distance from another point.
vector3d< T > getNormal() const
Get the normal of the triangle.
bool isPointInsideFast(const vector3d< T > &p) const
Check if a point is inside the triangle (border-points count also as inside)
Template plane class with some intersection testing methods.
bool isTotalOutsideBox(const aabbox3d< T > &box) const
Determines if the triangle is totally outside a bounding box.
triangle3d< s32 > triangle3di
Typedef for an integer 3d triangle.
bool getIntersectionWithLine(const vector3d< T > &linePoint, const vector3d< T > &lineVect, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
vector3d< T > & normalize()
Normalizes the vector.
vector3d< T > MinEdge
The near edge.
core::vector3d< T > closestPointOnTriangle(const core::vector3d< T > &p) const
Get the closest point on a triangle to a point on the same plane.
vector3d< T > start
Start point of line.
triangle3d(vector3d< T > v1, vector3d< T > v2, vector3d< T > v3)
Constructor for triangle with given three vertices.
T getArea() const
Get the area of the triangle.
T Z
Z coordinate of the vector.
Axis aligned bounding box in 3d dimensional space.
bool isPointInside(const vector3d< T > &p) const
Determines if a point is within this box.
T dotProduct(const vector3d< T > &other) const
Get the dot product with another vector.
#define F32_LOWER_EQUAL_0(n)