15 #ifndef __Thea_Hyperplane3_hpp__ 16 #define __Thea_Hyperplane3_hpp__ 19 #include "HyperplaneN.hpp" 34 static HyperplaneN fromThreePoints(VectorT
const & point1, VectorT
const & point2, VectorT
const & point3)
38 hyperplane.
normal = (point2 - point1).cross(point3 - point1).normalized();
39 hyperplane.
dist = hyperplane.
normal.dot(point1);
49 T sqlen = hyperplane.
normal.squaredNorm();
52 hyperplane.
normal = VectorT::Zero();
57 T len = std::sqrt(sqlen);
59 hyperplane.
dist = -d / len;
65 using BaseT::getEquation;
78 #ifdef THEA_EXPORT_INSTANTIATION Root namespace for the Thea library.
VectorT normal
The unit normal vector of the hyperplane.
T dist
The signed distance of the hyperplane from the origin.
A hyperplane ((N - 1)-flat) in N-dimensional space, where N is any positive (non-zero) integer and T ...
void getEquation(T &a, T &b, T &c, T &d) const
Get the coefficients a, b, c, d of the plane equation a * x + b * y + c * z + d = 0...
bool fuzzyEq(T const &a, T const &b, T const &tol)
Check if two numbers are approximately equal, with a given tolerance.
static HyperplaneN fromEquation(T const &a, T const &b, T const &c, T const &d)
Construct a hyperplane given coefficients a, b, c, d of the plane equation a * x + b * y + c * z + d ...
Vector< N, T > VectorT
N-dimensional vector.
[Internal] Base class for hyperplanes ((N - 1)-flats) in N-dimensional space, where N is any positive...
HyperplaneN< 3, Real > Plane3
The default plane class in 3-dimensional real space.