Thea
|
A hyperplane ((N - 1)-flat) in N-dimensional space, where N is any positive (non-zero) integer and T is a field. More...
#include <HyperplaneN.hpp>
Public Types | |
typedef HyperplaneN< N, T > | HyperplaneT |
N-dimensional hyperplane. More... | |
typedef Vector< N, T > | VectorT |
N-dimensional vector. More... | |
Public Member Functions | |
template<typename U > | |
HyperplaneN< N, U > | cast () const |
Cast the hyperplane to a different scalar type. More... | |
VectorT | closestPoint (VectorT const &p) const |
Get the point on the hyperplane closest to a given point. More... | |
T | distance (VectorT const &p) const |
Get the (unsigned) distance of a given point from the hyperplane. More... | |
void | flip () |
Flip the hyperplane so that the normal points the other way. More... | |
Vector< N+1, T > | getEquation () const |
Get the coefficients {a_i} of the hyperplane equation a_0 * x_0 + a_1 * x_1 + ... More... | |
VectorT const & | getNormal () const |
Get the unit normal vector of the hyperplane. More... | |
VectorT | getPoint () const |
Get a point on the hyperplane. More... | |
HyperplaneN () | |
Default constructor. More... | |
bool | negativeHalfSpaceContains (VectorT const &p) const |
Check if the negative half space (the side of the hyperplane not containing the normal) contains a given point. More... | |
bool | positiveHalfSpaceContains (VectorT const &p) const |
Check if the positive half space (the side of the hyperplane containing the normal) contains a given point. More... | |
RayIntersectionN< N, T > | rayIntersection (RayN< N, T > const &ray, T max_time=-1) const |
Get the intersection of a ray with the object, including the hit time and the normal at the intersection point. More... | |
T | rayIntersectionTime (RayN< N, T > const &ray, T max_time=-1) const |
Get the time taken for a ray to intersect the object, or a negative value if there was no intersection in the forward direction. More... | |
bool | rayIntersects (RayN< N, T > const &ray, T max_time=-1) const |
Check if a ray intersects the object in the forward direction. More... | |
VectorT | reflect (VectorT const &p) const |
Reflect a point in the hyperplane. More... | |
T | signedDistance (VectorT const &p) const |
Get the signed distance of a given point from the hyperplane. More... | |
T | squaredDistance (VectorT const &p) const |
Get the square of the distance of the hyperplane from a given point. More... | |
std::string | toString () const |
Get a textual description of the hyperplane. More... | |
Static Public Member Functions | |
static HyperplaneT | fromDistanceAndNormal (T dist_, VectorT const &normal_, bool normalize=true) |
Construct a hyperplane from its signed distance from the origin, and its normal vector (need not be a unit vector). More... | |
static HyperplaneT | fromNPoints (Array< VectorT > const &points) |
Construct a hyperplane from N points on it. More... | |
static HyperplaneT | fromPointAndNormal (VectorT const &point_, VectorT const &normal_, bool normalize=true) |
Construct a hyperplane from a point on it, and its normal vector (need not be a unit vector). More... | |
Protected Attributes | |
T | dist |
The signed distance of the hyperplane from the origin. More... | |
VectorT | normal |
The unit normal vector of the hyperplane. More... | |
A hyperplane ((N - 1)-flat) in N-dimensional space, where N is any positive (non-zero) integer and T is a field.
Definition at line 27 of file HyperplaneN.hpp.
|
inherited |
N-dimensional hyperplane.
Definition at line 41 of file HyperplaneN.hpp.
N-dimensional vector.
Definition at line 42 of file HyperplaneN.hpp.
HyperplaneN | ( | ) |
Default constructor.
Definition at line 235 of file HyperplaneN.hpp.
|
inherited |
Cast the hyperplane to a different scalar type.
Definition at line 102 of file HyperplaneN.hpp.
Get the point on the hyperplane closest to a given point.
Definition at line 157 of file HyperplaneN.hpp.
|
inherited |
Get the (unsigned) distance of a given point from the hyperplane.
Definition at line 136 of file HyperplaneN.hpp.
|
inherited |
Flip the hyperplane so that the normal points the other way.
Definition at line 129 of file HyperplaneN.hpp.
|
staticinherited |
Construct a hyperplane from its signed distance from the origin, and its normal vector (need not be a unit vector).
The normalize argument suppresses rescaling of the normal to unit length if set to false.
Definition at line 53 of file HyperplaneN.hpp.
|
staticinherited |
Construct a hyperplane from N points on it.
Definition at line 76 of file HyperplaneN.hpp.
|
staticinherited |
Construct a hyperplane from a point on it, and its normal vector (need not be a unit vector).
The normalize argument suppresses rescaling of the normal to unit length if set to false.
Definition at line 66 of file HyperplaneN.hpp.
|
inherited |
Get the coefficients {a_i} of the hyperplane equation a_0 * x_0 + a_1 * x_1 + ...
Definition at line 116 of file HyperplaneN.hpp.
|
inherited |
Get the unit normal vector of the hyperplane.
Definition at line 111 of file HyperplaneN.hpp.
|
inherited |
Get a point on the hyperplane.
Definition at line 108 of file HyperplaneN.hpp.
|
inherited |
Check if the negative half space (the side of the hyperplane not containing the normal) contains a given point.
Returns true if the point lies on the hyperplane.
Definition at line 175 of file HyperplaneN.hpp.
|
inherited |
Check if the positive half space (the side of the hyperplane containing the normal) contains a given point.
Returns true if the point lies on the hyperplane.
Definition at line 166 of file HyperplaneN.hpp.
|
virtualinherited |
Get the intersection of a ray with the object, including the hit time and the normal at the intersection point.
A negative time is returned if there was no intersection in the forward direction. If the normal cannot be computed, the zero vector is returned.
ray | The ray to test for intersection. |
max_time | Maximum allowable hit time, ignored if negative. |
Reimplemented from RayIntersectableN< N, T >.
Definition at line 204 of file HyperplaneN.hpp.
|
virtualinherited |
Get the time taken for a ray to intersect the object, or a negative value if there was no intersection in the forward direction.
All subclasses must reimplement this method. If the return value is negative, it should be at least
ray | The ray to test for intersection. |
max_time | Maximum allowable hit time, ignored if negative. |
Implements RayIntersectableN< N, T >.
Definition at line 191 of file HyperplaneN.hpp.
|
virtualinherited |
Check if a ray intersects the object in the forward direction.
ray | The ray to test for intersection. |
max_time | Maximum allowable hit time, ignored if negative. |
Reimplemented from RayIntersectableN< N, T >.
Definition at line 186 of file HyperplaneN.hpp.
Reflect a point in the hyperplane.
Definition at line 181 of file HyperplaneN.hpp.
|
inherited |
Get the signed distance of a given point from the hyperplane.
This is positive if the point is on the side of the hyperplane containing the normal, and negative if the point is on the other side.
Definition at line 145 of file HyperplaneN.hpp.
|
inherited |
Get the square of the distance of the hyperplane from a given point.
Definition at line 151 of file HyperplaneN.hpp.
|
inherited |
Get a textual description of the hyperplane.
Definition at line 214 of file HyperplaneN.hpp.
|
protectedinherited |
The signed distance of the hyperplane from the origin.
Definition at line 223 of file HyperplaneN.hpp.
|
protectedinherited |
The unit normal vector of the hyperplane.
Definition at line 222 of file HyperplaneN.hpp.