geomc 1.0
A c++ linear algebra template library
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
Plane< T, N > Class Template Reference

A geometric plane or hyperplane. More...

#include <geomc/shape/Plane.h>

Inheritance diagram for Plane< T, N >:
SdfEvaluable< T, N, Plane< T, N > >

Public Member Functions

 Plane ()
 
 Plane (Vec< T, N > n)
 
 Plane (Vec< T, N > n, Vec< T, N > pt)
 
distance (const Vec< T, N > p) const
 
sdf (Vec< T, N > p) const
 
bool contains (const Vec< T, N > p) const
 
template<typename ConvexShape >
bool contains (const ConvexShape &shape) const
 
Vec< T, N > project (Vec< T, N > p) const
 
Vec< T, N > origin () const
 
void apply (const AffineTransform< T, N > &xf)
 
void apply_inverse (const AffineTransform< T, N > &xf)
 
template<typename ConvexShape >
bool intersects (const ConvexShape &shape) const
 
bool intersects (const Sphere< T, N > &s) const
 
bool intersects (const Vec< T, N > *hull, index_t npts) const
 
Plane< T, N > & operator*= (const AffineTransform< T, N > &tx)
 
Plane< T, N > & operator/= (const AffineTransform< T, N > &tx)
 

Static Public Member Functions

static Plane from_basis (const Vec< T, N > bases[N-1])
 
static Plane from_basis (const Vec< T, N > bases[N-1], Vec< T, N > p)
 
static Plane from_simplex (const Vec< T, N > points[N])
 

Public Attributes

Vec< T, N > normal
 Normal direction, unit length.
 
d
 Distance along the unit normal from the origin to the plane surface.
 

Friends

Plane< T, N > operator* (const AffineTransform< T, N > &tx, Plane< T, N > p)
 
Plane< T, N > operator/ (Plane< T, N > p, const AffineTransform< T, N > &tx)
 

Detailed Description

template<typename T, index_t N>
class geom::Plane< T, N >

A geometric plane or hyperplane.

A Euclidean subspace of RN with dimension N-1.

Constructor & Destructor Documentation

◆ Plane() [1/3]

Plane ( )
inline

Construct a plane with a normal along +x, crossing the origin.

◆ Plane() [2/3]

Plane ( Vec< T, N >  n)
inline

Construct a plane with normal n.

Parameters
nNormal direction.

◆ Plane() [3/3]

Plane ( Vec< T, N >  n,
Vec< T, N >  pt 
)
inline

Construct a plane with normal n passing through the point pt.

Parameters
nNormal direction.
ptA point on the plane.

Member Function Documentation

◆ apply()

void apply ( const AffineTransform< T, N > &  xf)
inline

Geometrically transform this plane by xf.

Parameters
xfAn affine transformation.

◆ apply_inverse()

void apply_inverse ( const AffineTransform< T, N > &  xf)
inline

Un-transform this plane by xf.

Parameters
xfAn affine transformation.

◆ contains() [1/2]

bool contains ( const ConvexShape &  shape) const
inline

Half-space test.

Returns
true if shape is completely on or below the surface of the plane (i.e. on the side opposite the normal); false otherwise.

◆ contains() [2/2]

bool contains ( const Vec< T, N >  p) const
inline

Half-space test.

Returns
true if p is on or below the surface of the plane (i.e. on the side opposite the normal); false otherwise.

◆ distance()

T distance ( const Vec< T, N >  p) const
inline
Returns
The distance from p along the normal direction to the surface of the plane. Negative if p is on the backfacing side of the plane.

◆ from_basis() [1/2]

static Plane from_basis ( const Vec< T, N >  bases[N-1])
inlinestatic

Construct a plane spanning the given basis vectors.

Parameters
basesAn array of N-1 bases.
Returns
A plane whose normal is orthogonal to all the given bases.

◆ from_basis() [2/2]

static Plane from_basis ( const Vec< T, N >  bases[N-1],
Vec< T, N >  p 
)
inlinestatic

Construct a plane spanning the given basis vectors through the given point.

Parameters
basesAn array of N-1 bases.
pPoint through which to construct the plane.
Returns
A plane whose normal is orthogonal to all the given bases.

◆ from_simplex()

static Plane from_simplex ( const Vec< T, N >  points[N])
inlinestatic

Construct a plane spanning the points on the given simplex (i.e. line segment, triangle, tetrahedron, etc; as appropriate for the dimension).

Parameters
pointsThe N vertecies of a simplex.
Returns
A plane on which the given simplex lies.

◆ intersects() [1/3]

bool intersects ( const ConvexShape &  shape) const
inline

Convex shape intersection test.

Returns
true if and only if this plane passes through shape.

◆ intersects() [2/3]

bool intersects ( const Sphere< T, N > &  s) const
inline

Sphere interesection test.

Returns
true if and only if this plane passes through s.

◆ intersects() [3/3]

bool intersects ( const Vec< T, N > *  hull,
index_t  npts 
) const
inline

Convex hull intersection test.

Parameters
hullA list of points whose convex hull is to be tested.
nptsNumber of points in the list.
Returns
true if this plane intersects the convex hull of hull, false otherwise,

◆ operator*=()

Plane< T, N > & operator*= ( const AffineTransform< T, N > &  tx)
inline

Affine transformation.

Parameters
txAn affine transformation to apply to this plane.

◆ operator/=()

Plane< T, N > & operator/= ( const AffineTransform< T, N > &  tx)
inline

Inverse affine transformation.

Parameters
txAn affine transformation to un-apply to this plane.

◆ origin()

Vec< T, N > origin ( ) const
inline
Returns
The point on the plane closest to the origin.

◆ project()

Vec< T, N > project ( Vec< T, N >  p) const
inline
Returns
p projected onto the plane.

◆ sdf()

T sdf ( Vec< T, N >  p) const
inline

Return the signed distance to the surface of the shape.

Friends And Related Function Documentation

◆ operator*

Plane< T, N > operator* ( const AffineTransform< T, N > &  tx,
Plane< T, N >  p 
)
friend

Affine transformation.

Parameters
txAn affine transformation.
pA plane.
Returns
A new plane representing p transformed by at.

◆ operator/

Plane< T, N > operator/ ( Plane< T, N >  p,
const AffineTransform< T, N > &  tx 
)
friend

Inverse affine transformation.

Parameters
pA plane.
txAn affine transformation.
Returns
A new plane representing p un-transformed by at.

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