ML Reference
|
Class defining a plane in 3D. More...
#include <mlPlane.h>
Public Member Functions | |
Plane () | |
Constructor. Normal defaults to (0,0,1) and distance to 0. | |
Plane (const Vector3 &normal, MLdouble distance) | |
Constructs plane from normal normal and distance from origin distance. | |
Plane (const Vector3 &p0, const Vector3 &p1, const Vector3 &p2) | |
Constructs plane from three points in space. | |
Plane (const Vector3 &normal, const Vector3 &point) | |
Constructs plane from normal and point in space. | |
Vector3 | getClosestPoint (const Vector3 &point) const |
Projection of point to Plane. | |
bool | intersect (const Line &l, Vector3 &intersection) const |
Intersect plane with line l and return intersection point in intersection. | |
bool | isInHalfSpace (const Vector3 &point) const |
Returns true if point lies in the halfspace of the plane into which the normal of the plane points (which is equal to getDistance(point) >= 0.0) | |
MLdouble | getDistance (const Vector3 &point) const |
Returns distance of point from plane. | |
const Vector3 & | getNormal () const |
Returns plane normal. | |
bool | setNormal (const Vector3 &n) |
Sets plane normal to n (performing normalization), or (1,0,0) if n == 0. | |
void | setDistance (double d) |
Sets distance from origin to d. | |
MLdouble | getDistanceFromOrigin () const |
Returns minimum distance of plane from origin. | |
MLSign | edgeIntersect (const Vector3 &v1, const Vector3 &v2, Vector3 &intersectPos) const |
Determines if an edge (line segment) bounded by v1 -> v2 intersects *this. |
ml::Plane::Plane | ( | ) |
Constructor. Normal defaults to (0,0,1) and distance to 0.
Constructs plane from normal normal and distance from origin distance.
It is up to the caller to avoid degenerated plane settings.
Constructs plane from three points in space.
It is up to the caller to avoid degenerated plane settings.
Constructs plane from normal and point in space.
It is up to the caller to avoid degenerated plane settings.
MLSign ml::Plane::edgeIntersect | ( | const Vector3 & | v1, |
const Vector3 & | v2, | ||
Vector3 & | intersectPos | ||
) | const |
Determines if an edge (line segment) bounded by v1 -> v2 intersects *this.
If there's an intersection, the sign of v1, NEGATIVE or POSITIVE, w.r.t. the plane is returned with the intersection intersect updated. Otherwise ZERO is returned and intersectPos is left unchanged.
Returns distance of point from plane.
MLdouble ml::Plane::getDistanceFromOrigin | ( | ) | const [inline] |
const Vector3& ml::Plane::getNormal | ( | ) | const |
Returns plane normal.
Intersect plane with line l and return intersection point in intersection.
Return true if line is not parallel to plane.
bool ml::Plane::isInHalfSpace | ( | const Vector3 & | point | ) | const |
Returns true if point lies in the halfspace of the plane into which the normal of the plane points (which is equal to getDistance(point) >= 0.0)
void ml::Plane::setDistance | ( | double | d | ) |
Sets distance from origin to d.
bool ml::Plane::setNormal | ( | const Vector3 & | n | ) |
Sets plane normal to n (performing normalization), or (1,0,0) if n == 0.
Returns true if n != 0.