![]() |
libgenua
Basic Geometry, Numerical Algorithms and Interfaces
|
A plane in three dimensions.
Can be initialized by a normal and distance from origin, or by two tangent vectors and a point in the plane. To create a plane from three points, use {verbatim} Vct3 a,b,c; Plane pl((a-b), (a-c), a); {verbatim} Plane supports computation of point distance and projections.
#include <plane.h>
Public Member Functions | |
Plane () | |
empty construction | |
Plane (CartesianPlaneType cartp, Real dst=0.0) | |
construct a plane aligned with coordinate axes | |
Plane (const Vct3 &n, Real d) | |
build from normal and distance from origin | |
Plane (const Vct3 &a, const Vct3 &b, const Vct3 &p) | |
build from two vectors in plane and a point | |
Vct3 | project (const Vct3 &p) const |
project point onto plane | |
Vct3 | reflection (const Vct3 &p) const |
return the mirror image of a point with respect to plane | |
Real | distance (const Vct3 &p) const |
calculate signed distance | |
bool | parallel (const Plane &pl) const |
is *this parallel to pl | |
Line< 3 > | intersection (const Plane &pl) const |
compute intersection line | |
PlnIts | pierce (const Line< 3 > &ln) const |
compute line parameter where line pierces plane | |
PlnIts | pierce (const Vct3 &p1, const Vct3 &p2) const |
compute line parameter where line pierces plane | |
const Vct3 & | vector () const |
return normal | |
Real | offset () const |
return offset (distance from origin) | |
const Vct3 & | fitNormal (const Vct3 &origin, const PointList< 3 > &pts) |
determine a normal vector so that the plane through origin minimizes the sum of squared distances for the points in pts | |
XmlElement | toXml (bool share) const |
return XML representation | |
void | fromXml (const XmlElement &xe) |
recover from XML representation | |
Private Attributes | |
Vct3 | m_normal |
normal vector | |
Real | m_dist |
distance from origin | |