Three-dimensional plane class. More...
#include <plane3.h>
Classes | |
class | BadPlane |
Ill-defined plane exception. More... |
Public Member Functions | |
Plane3 () | |
Plane3 (const Unit3 &norm, const Scalar &dist, const DirectionType &type=DIRECTED) | |
Constructor for unit normal vector and distance to the origin input. | |
Plane3 (const Vector3 &norm, const Scalar &dist, const DirectionType &type=DIRECTED) | |
Plane3 (const Unit3 &norm, const Point3 &sup, const DirectionType &type=DIRECTED) | |
Constructor for unit normal vector and support point input. | |
Plane3 (const Vector3 &norm, const Point3 &sup, const DirectionType &type=DIRECTED) | |
Constructor for non-unit normal vector and support point input. | |
Plane3 (const Point3 ¹, const Point3 ², const Point3 ³, const DirectionType &type=UNDIRECTED) | |
Constructor for three support points. | |
bool | operator== (const Plane3 &P) const |
bool | operator!= (const Plane3 &P) const |
Point3 | project (const Point3 &p) const |
Projects point p on current plane. | |
Scalar | distance (const Point3 &p) const |
Unsigned distance from point p to current plane. | |
Unit3 | getNormal () const |
Gets plane normal unit vector. | |
Unit3 & | getNormalRef () |
const Unit3 & | getNormalRef () const |
Scalar | getDistOrig () const |
Scalar & | getDistOrigRef () |
const Scalar & | getDistOrigRef () const |
Point3 | getSupport () const |
DirectionType | getDirectionType () const |
Gets plane direction type. | |
DirectionType & | getDirectionTypeRef () |
const DirectionType & | getDirectionTypeRef () const |
Unit3 | getSupportVector () const |
Plane3 | getParallelPlane (const Scalar &d) const |
Returns a plane parallel to the current plane separated by d. | |
void | setNormal (const Unit3 &norm) |
Sets plane normal unit vector. | |
void | setDistOrig (const Scalar &dist) |
Sets signed distance from the plane to the coordinate system origin. | |
void | setSupport (const Point3 &sup) |
Sets plane support point. | |
void | setDirectionType (const DirectionType &type) |
Sets plane direction type. | |
void | setValue (const Unit3 &norm, const Scalar &dist, const DirectionType &type=DIRECTED) |
Sets plane with normal, distance to origin, and direction type. | |
void | setValue (const Unit3 &norm, const Point3 &sup, const DirectionType &type=DIRECTED) |
Sets plane with normal, support point, and direction type. | |
void | setValue (const Point3 ¹, const Point3 ², const Point3 ³, const DirectionType &type=DIRECTED) |
Sets plane with three support points. |
Three-dimensional plane class.
Planes are represented using the Hessian normal form
where
Additionally, a plane can be considered to be directed or undirected. If two directed planes differ only in that their normal vectors are antiparallel, they are considered different. If at least one of the planes is undirected, then they are considered to be equal. If left unspecified in the constructor, all planes are considered directed except for planes constructed from three support points (see example below)
After a plane is constructed, it is tested to ensure it was well defined. For example, after constructing a plane with a normal vector and support point inputs, the support point is tested to ensure it is contained in the plane. Another case that can yield an ill-defined situation is a plane constructed with three almost-collinear points.
This is an example of how to use the Plane3 class:
|
inline |
Default constructor. Creates a directed plane coincident with the xy plane.
|
inline |
Constructor for non-unit normal vector and distance to the origin input.
|
inline |
Gets signed distance from the plane to the coordinate system origin. The sign of this distance is determined by the direction of the plane normal
|
inline |
Gets plane support point that is closest to the coordinate system origin.
|
inline |
Gets a unit vector perpendicular to the plane normal.
If the coordinate system axis closest to the plane normal is x, the return vector will point in the direction of the y axis projected on the plane. Otherwise it will point in the direction of the y axis projected on the plane.