5 #ifndef __IRR_PLANE_3D_H_INCLUDED__ 6 #define __IRR_PLANE_3D_H_INCLUDED__ 46 {
setPlane(point1, point2, point3); }
73 Normal = (point2 - point1).crossProduct(point3 - point1);
90 T t2 =
Normal.dotProduct(lineVect);
95 T
t =- (
Normal.dotProduct(linePoint) +
D) / t2;
96 outIntersection = linePoint + (lineVect *
t);
112 return (
f32)-((
Normal.dotProduct(linePoint1) +
D) / t2);
137 const T d =
Normal.dotProduct(point) +
D;
177 const T fn00 =
Normal.getLength();
179 const T fn11 = other.
Normal.getLength();
180 const f64 det = fn00*fn11 - fn01*fn01;
185 const f64 invdet = 1.0 / det;
186 const f64 fc0 = (fn11*-
D + fn01*other.
D) * invdet;
187 const f64 fc1 = (fn00*-other.
D + fn01*
D) * invdet;
216 const f32 d =
Normal.dotProduct(lookDirection);
bool operator!=(const plane3d< T > &other) const
vector3d< T > getMemberPoint() const
Gets a member point of the plane.
plane3d(const vector3d< T > &point1, const vector3d< T > &point2, const vector3d< T > &point3)
float f32
32 bit floating point variable.
T getDistanceTo(const vector3d< T > &point) const
Get the distance to a point.
void setPlane(const vector3d< T > &point1, const vector3d< T > &point2, const vector3d< T > &point3)
f32 getKnownIntersectionWithLine(const vector3d< T > &linePoint1, const vector3d< T > &linePoint2) const
Get percentage of line between two points where an intersection with this plane happens.
vector3d< T > Normal
Normal vector of the plane.
plane3d(const vector3d< T > &MPoint, const vector3d< T > &Normal)
EIntersectionRelation3D
Enumeration for intersection relations of 3d objects.
Everything in the Irrlicht Engine can be found in this namespace.
3d vector template class with lots of operators and methods.
void setPlane(const vector3d< T > &nvect, T d)
plane3d(const vector3d< T > &normal, const T d)
bool existsIntersection(const plane3d< T > &other) const
Tests if there is an intersection with the other plane.
bool getIntersectionWithPlanes(const plane3d< T > &o1, const plane3d< T > &o2, vector3d< T > &outPoint) const
Get the intersection point with two other planes if there is one.
double f64
64 bit floating point variable.
plane3d< s32 > plane3di
Typedef for an integer 3d plane.
const f32 ROUNDING_ERROR_f32
plane3d(T px, T py, T pz, T nx, T ny, T nz)
bool getIntersectionWithLine(const vector3d< T > &linePoint, const vector3d< T > &lineVect, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
bool equals(const T a, const T b, const T tolerance=roundingError< T >())
returns if a equals b, taking possible rounding errors into account
const f64 ROUNDING_ERROR_f64
void setPlane(const vector3d< T > &point, const vector3d< T > &nvector)
Template plane class with some intersection testing methods.
bool getIntersectionWithPlane(const plane3d< T > &other, vector3d< T > &outLinePoint, vector3d< T > &outLineVect) const
Intersects this plane with another.
bool getIntersectionWithLimitedLine(const vector3d< T > &linePoint1, const vector3d< T > &linePoint2, vector3d< T > &outIntersection) const
Get an intersection with a 3d line, limited between two 3d points.
T dotProduct(const vector3d< T > &other) const
Get the dot product with another vector.
bool isFrontFacing(const vector3d< T > &lookDirection) const
Test if the triangle would be front or backfacing from any 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 getLength() const
Get length of the vector.
void recalculateD(const vector3d< T > &MPoint)
Recalculates the distance from origin by applying a new member point to the plane.
EIntersectionRelation3D classifyPointRelation(const vector3d< T > &point) const
Classifies the relation of a point to this plane.
bool operator==(const plane3d< T > &other) const
plane3d< f32 > plane3df
Typedef for a f32 3d plane.
#define F32_LOWER_EQUAL_0(n)