Thea
HyperplaneN< N, T > Class Template Reference

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>`

Inheritance diagram for HyperplaneN< N, T >: ## 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...

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...

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...

signedDistance (VectorT const &p) const
Get the signed distance of a given point from the hyperplane. More...

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

dist
The signed distance of the hyperplane from the origin. More...

VectorT normal
The unit normal vector of the hyperplane. More...

## Detailed Description

### template<int N, typename T = Real> class Thea::HyperplaneN< N, T >

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.

## Member Typedef Documentation

 typedef HyperplaneN HyperplaneT
inherited

N-dimensional hyperplane.

Definition at line 41 of file HyperplaneN.hpp.

 typedef Vector VectorT
inherited

N-dimensional vector.

Definition at line 42 of file HyperplaneN.hpp.

## Constructor & Destructor Documentation

 HyperplaneN ( )

Default constructor.

Definition at line 235 of file HyperplaneN.hpp.

## Member Function Documentation

 HyperplaneN cast ( ) const
inherited

Cast the hyperplane to a different scalar type.

Definition at line 102 of file HyperplaneN.hpp.

 VectorT closestPoint ( VectorT const & p ) const
inherited

Get the point on the hyperplane closest to a given point.

Definition at line 157 of file HyperplaneN.hpp.

 T distance ( VectorT const & p ) const
inherited

Get the (unsigned) distance of a given point from the hyperplane.

Definition at line 136 of file HyperplaneN.hpp.

 void flip ( )
inherited

Flip the hyperplane so that the normal points the other way.

Definition at line 129 of file HyperplaneN.hpp.

 static HyperplaneT fromDistanceAndNormal ( T dist_, VectorT const & normal_, bool normalize = `true` )
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.

 static HyperplaneT fromNPoints ( Array< VectorT > const & points )
staticinherited

Construct a hyperplane from N points on it.

Definition at line 76 of file HyperplaneN.hpp.

 static HyperplaneT fromPointAndNormal ( VectorT const & point_, VectorT const & normal_, bool normalize = `true` )
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.

 Vector getEquation ( ) const
inherited

Get the coefficients {a_i} of the hyperplane equation a_0 * x_0 + a_1 * x_1 + ...

• a_{N - 1} * x_{N - 1} + a_N * 1 = 0.

Definition at line 116 of file HyperplaneN.hpp.

 VectorT const& getNormal ( ) const
inherited

Get the unit normal vector of the hyperplane.

Definition at line 111 of file HyperplaneN.hpp.

 VectorT getPoint ( ) const
inherited

Get a point on the hyperplane.

Definition at line 108 of file HyperplaneN.hpp.

 bool negativeHalfSpaceContains ( VectorT const & p ) const
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.

 bool positiveHalfSpaceContains ( VectorT const & p ) const
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.

 RayIntersectionN rayIntersection ( RayN< N, T > const & ray, T max_time = `-1` ) const
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.

Parameters
 ray The ray to test for intersection. max_time Maximum allowable hit time, ignored if negative.
Note
The returned normal need not have unit length.

Reimplemented from RayIntersectableN< N, T >.

Definition at line 204 of file HyperplaneN.hpp.

 T rayIntersectionTime ( RayN< N, T > const & ray, T max_time = `-1` ) const
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

Parameters
 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.

 bool rayIntersects ( RayN< N, T > const & ray, T max_time = `-1` ) const
virtualinherited

Check if a ray intersects the object in the forward direction.

Parameters
 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.

 VectorT reflect ( VectorT const & p ) const
inherited

Reflect a point in the hyperplane.

Definition at line 181 of file HyperplaneN.hpp.

 T signedDistance ( VectorT const & p ) const
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.

 T squaredDistance ( VectorT const & p ) const
inherited

Get the square of the distance of the hyperplane from a given point.

Definition at line 151 of file HyperplaneN.hpp.

 std::string toString ( ) const
inherited

Get a textual description of the hyperplane.

Definition at line 214 of file HyperplaneN.hpp.

## Member Data Documentation

 T dist
protectedinherited

The signed distance of the hyperplane from the origin.

Definition at line 223 of file HyperplaneN.hpp.

 VectorT normal
protectedinherited

The unit normal vector of the hyperplane.

Definition at line 222 of file HyperplaneN.hpp.

The documentation for this class was generated from the following file: