AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::primal::Plane< T, NDIMS > Class Template Reference

Defines an oriented plane within a 2-D or 3-D Euclidean space and provides associated operators, such as, projection, signed distance, orientation, etc. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/primal/geometry/Plane.hpp>

Public Member Functions

 ~Plane ()
 Destructor. More...
 
int getDimension () const
 Returns the dimension of the Plane. More...
 
const T * getNormal () const
 Returns a const pointer to the plane's unit normal. More...
 
getOffset () const
 Returns the offset of the plane from origin. More...
 
computeSignedDistance (const T *x) const
 Computes the signed distance of the specified point to this Plane. More...
 
void projectPoint (const T *x, T *projx) const
 Computes the projection of a given point, x, onto this Plane. More...
 
void flip ()
 Flips the orientation of the plane. More...
 
int getOrientation (const T *x, double TOL=1.e-9) const
 Computes the orientation of the point with respect to this Plane. More...
 
std::ostream & print (std::ostream &os) const
 Prints the Plane information in the given output stream. More...
 
Constructors
 Plane (const T *normal, const T *x)
 Constructs a Plane with a given normal, \( \mathcal{N} \), that passes through the specified point, \( x \). More...
 
 Plane (const T *normal, T offset)
 Constructs a plane with a specified normal, \( \mathcal{N} \), located at the given offset from origin. More...
 
 Plane (const T *x1, const T *x2, const T *x3)
 Constructs a Plane that goes through the specified points. More...
 

Detailed Description

template<typename T, int NDIMS>
class axom::primal::Plane< T, NDIMS >

Defines an oriented plane within a 2-D or 3-D Euclidean space and provides associated operators, such as, projection, signed distance, orientation, etc.

The Plane object defines an oriented plane in Hessian Normal form:

\( \mathcal{N} \cdot x - d = 0 \)

where, \( \mathcal{N} \) is a unit normal and \( d \) is the offset of the plane (in the direction of the specified normal) to the origin.

The Plane class defines a co-dimension-one plane that splits the ambient space into two halfspaces, such that, the signed distance for any point is: (a) negative below the plance, (b) positive above the plane and (c) zero on the plane.

A Plane object may be constructed in three ways:

  1. Specifying a normal and a point that the plane passes through
  2. Specifying a normal and an offset from the origin, or
  3. Specifying the points that the plane passes through. A minimum of two points are required to define a plane in 2D, or, three points for 3D.
Template Parameters
Tthe underlying data type, e.g., double, float, etc.
NDIMSthe number of dimensions
Precondition
NDIMS==2 || NDIMS==3

Constructor & Destructor Documentation

◆ Plane() [1/3]

template<typename T , int NDIMS>
axom::primal::Plane< T, NDIMS >::Plane ( const T *  normal,
const T *  x 
)

Constructs a Plane with a given normal, \( \mathcal{N} \), that passes through the specified point, \( x \).

Parameters
[in]normalthe supplied plane normal, \( \mathcal{N} \)
[in]xa specified point that the plane passes through, \( x \)
Note
The supplied normal will be normalized, such that, the Plane's normal will always be a unit normal.
The supplied buffers, normal and x must point to buffers that are at least NDIMS long
Precondition
normal != nullptr
x != nullptr

References AXOM_STATIC_ASSERT_MSG, axom::numerics::dot_product(), axom::numerics::normalize(), and SLIC_ASSERT.

◆ Plane() [2/3]

template<typename T , int NDIMS>
axom::primal::Plane< T, NDIMS >::Plane ( const T *  normal,
offset 
)

Constructs a plane with a specified normal, \( \mathcal{N} \), located at the given offset from origin.

Parameters
[in]normalthe supplied plane normal, \( \mathcal{N} \)
[in]offsetthe plane offset from origin
Note
The supplied normal will be normalized, such that, the Plane's normal will always be a unit normal.
Precondition
normal != nullptr

References AXOM_STATIC_ASSERT_MSG, axom::numerics::normalize(), and SLIC_ASSERT.

◆ Plane() [3/3]

template<typename T , int NDIMS>
axom::primal::Plane< T, NDIMS >::Plane ( const T *  x1,
const T *  x2,
const T *  x3 
)

Constructs a Plane that goes through the specified points.

Parameters
[in]x1coordinates of the first point.
[in]x2coordinates of the second point.
[in]x3coordinates of the third point, or nullptr for 2D.
Note
Two points are required to define a plane in 2D, in which case, the caller must pass nullptr as the third argument to this constructor.
The specified points, x1, x2, x3, must point to buffers that are at least NDIMS long
Precondition
x1 != nullptr
x2 != nullptr
x3 != nullptr \( \iff \) NDIMS==3
In 2D, x1 should not be equal to x2
In 3D, the user-supplied points, x1, x2, x3 should not be collinear.

References AXOM_STATIC_ASSERT_MSG, axom::numerics::cross_product(), axom::numerics::dot_product(), axom::utilities::isNearlyEqual(), axom::numerics::normalize(), SLIC_ASSERT, and SLIC_ERROR_IF.

◆ ~Plane()

template<typename T , int NDIMS>
axom::primal::Plane< T, NDIMS >::~Plane ( )

Destructor.

Member Function Documentation

◆ getDimension()

template<typename T , int NDIMS>
int axom::primal::Plane< T, NDIMS >::getDimension ( ) const
inline

Returns the dimension of the Plane.

Returns
dim the dimension of the Plane.
Postcondition
(dim==2) || (dim==3)

◆ getNormal()

template<typename T , int NDIMS>
const T* axom::primal::Plane< T, NDIMS >::getNormal ( ) const
inline

Returns a const pointer to the plane's unit normal.

Returns
N the unit normal.
Postcondition
N != nullptr

◆ getOffset()

template<typename T , int NDIMS>
T axom::primal::Plane< T, NDIMS >::getOffset ( ) const
inline

Returns the offset of the plane from origin.

Returns
offSet the offset of the plane from origin.

◆ computeSignedDistance()

template<typename T , int NDIMS>
T axom::primal::Plane< T, NDIMS >::computeSignedDistance ( const T *  x) const
inline

Computes the signed distance of the specified point to this Plane.

Parameters
[in]xbuffer consisting of the query point coordinates.
Returns
d the signed distance of the point x to the plane.
Note
x, should point to a buffer that is at least NDIMS long.
Precondition
x != nullptr

References axom::numerics::dot_product(), axom::primal::Plane< T, NDIMS >::flip(), axom::primal::Plane< T, NDIMS >::getOrientation(), axom::primal::Plane< T, NDIMS >::print(), and axom::primal::Plane< T, NDIMS >::projectPoint().

Referenced by axom::primal::Plane< T, NDIMS >::getOrientation(), and axom::primal::Plane< T, NDIMS >::projectPoint().

◆ projectPoint()

template<typename T , int NDIMS>
void axom::primal::Plane< T, NDIMS >::projectPoint ( const T *  x,
T *  projx 
) const
inline

Computes the projection of a given point, x, onto this Plane.

Parameters
[in]xbuffer consisting of the coordinates of the point to project.
[out]projxbuffer to store the coordinates of the projected point.
Note
x should point to a buffer that is at least NDIMS long.
projx should point to a buffer that is at least NDIMS long.
Precondition
x != nullptr
projx != nullptr
Postcondition
this->getOrientedSide( projx ) == ON_BOUNDARY

References axom::primal::Plane< T, NDIMS >::computeSignedDistance().

Referenced by axom::primal::Plane< T, NDIMS >::computeSignedDistance().

◆ flip()

template<typename T , int NDIMS>
void axom::primal::Plane< T, NDIMS >::flip ( )
inline

Flips the orientation of the plane.

Referenced by axom::primal::Plane< T, NDIMS >::computeSignedDistance().

◆ getOrientation()

template<typename T , int NDIMS>
int axom::primal::Plane< T, NDIMS >::getOrientation ( const T *  x,
double  TOL = 1.e-9 
) const
inline

Computes the orientation of the point with respect to this Plane.

Parameters
[in]xbuffer consisting of the query point coordinates.
[in]TOLuser-supplied tolerance. Optional. Default is 1.e-9.
Returns
orientation the orientation of the point
Note
This method returns one of the following values:
  • ON_BOUNDARY : if x lies on the plane
  • ON_POSITIVE_SIDE : if x is above the plane
  • ON_NEGATIVE_SIDE : if x is below the plane
See also
OrientationResult
Precondition
x != nullptr

References axom::primal::Plane< T, NDIMS >::computeSignedDistance(), axom::utilities::isNearlyEqual(), axom::primal::ON_BOUNDARY, axom::primal::ON_NEGATIVE_SIDE, and axom::primal::ON_POSITIVE_SIDE.

Referenced by axom::primal::Plane< T, NDIMS >::computeSignedDistance().

◆ print()

template<typename T , int NDIMS>
std::ostream & axom::primal::Plane< T, NDIMS >::print ( std::ostream &  os) const

Prints the Plane information in the given output stream.

Parameters
[in]osThe output stream to write to.
Note
This method is primarily used for debugging.
Returns
s the modified output stream object.

Referenced by axom::primal::Plane< T, NDIMS >::computeSignedDistance().


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