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 a plane from normal normal and distance from origin distance. | |
Plane (const Vector3 &p0, const Vector3 &p1, const Vector3 &p2) | |
Constructs a plane from three points in space. | |
Plane (const Vector3 &normal, const Vector3 &point) | |
Constructs a plane from normal and point in space. | |
Vector3 | getClosestPoint (const Vector3 &point) const |
Projects a point onto this plane. | |
bool | intersect (const Line &l, Vector3 &intersection) const |
Intersects this plane with line l and returns the intersection point in intersection. | |
bool | isInHalfSpace (const Vector3 &point) const |
Returns whether the point lies in the half-space 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 the distance of point from plane. | |
const Vector3 & | getNormal () const |
Returns the plane normal. | |
bool | setNormal (const Vector3 &n) |
Sets the plane normal to n (performing normalization), or (1,0,0) if n == 0. | |
void | setDistance (double d) |
Sets the distance from origin to d. | |
MLdouble | getDistanceFromOrigin () const |
Returns the minimum distance of plane from origin. | |
MLSign | edgeIntersect (const Vector3 &v1, const Vector3 &v2, Vector3 &intersectPos) const |
Determines whether 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 a plane from normal normal and distance from origin distance.
It is up to the caller to avoid degenerated plane settings.
Constructs a plane from three points in space.
It is up to the caller to avoid degenerated plane settings.
Constructs a 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 whether 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 the distance of point from plane.
|
inline |
const Vector3 & ml::Plane::getNormal | ( | ) | const |
Returns the plane normal.
Intersects this plane with line l and returns the intersection point in intersection.
Return whether the line is not parallel to plane.
bool ml::Plane::isInHalfSpace | ( | const Vector3 & | point | ) | const |
Returns whether the point lies in the half-space 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 the distance from origin to d.
bool ml::Plane::setNormal | ( | const Vector3 & | n | ) |
Sets the plane normal to n (performing normalization), or (1,0,0) if n == 0.
Returns whether n != 0.