Class Plane



This class lets us create a surface by specifying three points on the plane. The order of the points matters, as it affects the direction of the surface normal.


Plane(void)

Default constructor. The created plane is invalid, and fromPoints should be called before using the other functions.


Plane(const Point3D &newPoint1, const Point3D &newPoint2, const Point3D &newPoint3)

Constructor, creates a plane that intersects the provided points.


void fromPoints(const Point3D &newPoint1, const Point3D &newPoint2, const Point3D &newPoint3)

Constructs a plane from the specified points.


std::vector<MHFloat> getEquation(void)

Returns a vector with four elements A, B, C and D from the general equation of a plane: Ax + By + Cz + D = 0.


MHFloat getSide(const Point3D &position)

getSide tells us which side of the plane position is located. It returns:


bool lineIntersect(const Point3D &lineA, const Point3D &lineB, Point3D &intersect)

Given two points that make up a line, finds the point of intersection between the line and this plane, and stores it in intersect. lineIntersect returns false if the line is parallel to the plane.


static MHVector surfaceNormal(void)

Given the three points that were used to construct the plane, return a normal vector with length 1 that is perpendicular to the front surface. The front is the side where point1, point2 and point3 are arranged in a clockwise direction. (clockwise winding)











Back to Contents