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);
Template plane class with some intersection testing methods.
EIntersectionRelation3D classifyPointRelation(const vector3d< T > &point) const
Classifies the relation of a point to this plane.
void setPlane(const vector3d< T > &nvect, T d)
vector3d< T > getMemberPoint() const
Gets a member point of the plane.
void setPlane(const vector3d< T > &point1, const vector3d< T > &point2, const vector3d< T > &point3)
plane3d(const vector3d< T > &normal, const T d)
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.
bool existsIntersection(const plane3d< T > &other) const
Tests if there is an intersection with the other plane.
void recalculateD(const vector3d< T > &MPoint)
Recalculates the distance from origin by applying a new member point to the plane.
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.
void setPlane(const vector3d< T > &point, const vector3d< T > &nvector)
plane3d(const vector3d< T > &point1, const vector3d< T > &point2, const vector3d< T > &point3)
plane3d(const vector3d< T > &MPoint, const vector3d< T > &Normal)
vector3d< T > Normal
Normal vector of the 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.
bool getIntersectionWithPlane(const plane3d< T > &other, vector3d< T > &outLinePoint, vector3d< T > &outLineVect) const
Intersects this plane with another.
T getDistanceTo(const vector3d< T > &point) const
Get the distance to a point.
bool isFrontFacing(const vector3d< T > &lookDirection) const
Test if the triangle would be front or backfacing from any point.
bool operator==(const plane3d< T > &other) const
bool operator!=(const plane3d< T > &other) const
bool getIntersectionWithLine(const vector3d< T > &linePoint, const vector3d< T > &lineVect, vector3d< T > &outIntersection) const
Get an intersection with a 3d line.
plane3d(T px, T py, T pz, T nx, T ny, T nz)
3d vector template class with lots of operators and methods.
T getLength() const
Get length of the vector.
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 dotProduct(const vector3d< T > &other) const
Get the dot product with another vector.
#define F32_LOWER_EQUAL_0(n)
const f64 ROUNDING_ERROR_f64
EIntersectionRelation3D
Enumeration for intersection relations of 3d objects.
const f32 ROUNDING_ERROR_f32
bool equals(const f64 a, const f64 b, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals b, taking possible rounding errors into account
plane3d< f32 > plane3df
Typedef for a f32 3d plane.
plane3d< s32 > plane3di
Typedef for an integer 3d plane.
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.