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/develop/src/axom/primal/geometry/Plane.hpp>

Inheritance diagram for axom::primal::Plane< T, NDIMS >:

Public Types

using VectorType = primal::Vector< T, NDIMS >
 
using PointType = primal::Point< T, NDIMS >
 

Public Member Functions

AXOM_HOST_DEVICE const VectorTypegetNormal () const
 Returns a const pointer to the plane's normal vector. More...
 
AXOM_HOST_DEVICEgetOffset () const
 Returns the offset of the plane from origin. More...
 
AXOM_HOST_DEVICEsignedDistance (const PointType &x) const
 Computes the signed distance of the specified point to this Plane. More...
 
AXOM_HOST_DEVICE PointType projectPoint (const PointType &x) const
 Computes the projection of a given point, x, onto this Plane. More...
 
AXOM_HOST_DEVICE PointType reflectPoint (const PointType &x) const
 Computes the reflection of a given point, x, across this Plane. More...
 
AXOM_HOST_DEVICE void flip ()
 Flips the orientation of the plane. More...
 
AXOM_HOST_DEVICE int getOrientation (const PointType &x, double TOL=1.e-9) const
 Computes the orientation of the point with respect to this Plane. More...
 
AXOM_HOST_DEVICE bool isValid (double TOL=PRIMAL_TINY) const
 Simple check for validity of a Plane. More...
 
std::ostream & print (std::ostream &os) const
 Prints the Plane information in the given output stream. More...
 
Constructors
 Plane ()=default
 Constructs a Plane with a zero normal vector and zero offset. More...
 
AXOM_HOST_DEVICE Plane (const VectorType &normal, const PointType &x, bool normalize=true)
 Constructs a Plane with a given normal, \( \mathcal{N} \), that passes through the specified point, \( x \). More...
 
AXOM_HOST_DEVICE Plane (const VectorType &normal, T offset, bool normalize=true)
 Constructs a plane with a specified normal, \( \mathcal{N} \), located at the given offset from origin. More...
 

Static Public Member Functions

static constexpr AXOM_HOST_DEVICE int getDimension ()
 Returns the dimension of the Plane. 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:

     \f$ \mathcal{N} \cdot x - d = 0 \f$

where, \( \mathcal{N} \) is a 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

Member Typedef Documentation

◆ VectorType

template<typename T , int NDIMS>
using axom::primal::Plane< T, NDIMS >::VectorType = primal::Vector<T, NDIMS>

◆ PointType

template<typename T , int NDIMS>
using axom::primal::Plane< T, NDIMS >::PointType = primal::Point<T, NDIMS>

Constructor & Destructor Documentation

◆ Plane() [1/3]

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

Constructs a Plane with a zero normal vector and zero offset.

Postcondition
isValid() == false

◆ Plane() [2/3]

template<typename T , int NDIMS>
AXOM_HOST_DEVICE axom::primal::Plane< T, NDIMS >::Plane ( const VectorType normal,
const PointType x,
bool  normalize = true 
)

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 \)
[in]normalizeif true, normalize the given vector (default: true)

References axom::primal::Point< T, NDIMS >::array(), axom::primal::Vector< T, NDIMS >::is_zero(), axom::numerics::normalize(), and SLIC_ASSERT_MSG.

◆ Plane() [3/3]

template<typename T , int NDIMS>
AXOM_HOST_DEVICE axom::primal::Plane< T, NDIMS >::Plane ( const VectorType normal,
offset,
bool  normalize = true 
)

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
[in]normalizeif true, normalize the given vector (default: true)

References axom::primal::Vector< T, NDIMS >::is_zero(), axom::numerics::normalize(), and SLIC_ASSERT_MSG.

Member Function Documentation

◆ getDimension()

template<typename T , int NDIMS>
static constexpr AXOM_HOST_DEVICE int axom::primal::Plane< T, NDIMS >::getDimension ( )
inlinestaticconstexpr

Returns the dimension of the Plane.

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

◆ getNormal()

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

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

Returns
N the normal vector.

◆ getOffset()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE 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.

◆ signedDistance()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE T axom::primal::Plane< T, NDIMS >::signedDistance ( const PointType 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.

References axom::primal::Vector< T, NDIMS >::dot().

◆ projectPoint()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE Plane< T, NDIMS >::PointType axom::primal::Plane< T, NDIMS >::projectPoint ( const PointType x) const

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

Parameters
[in]xbuffer consisting of the coordinates of the point to project.
Returns
projx the coordinates of the projected point.
Postcondition
this->getOrientedSide( projx ) == ON_BOUNDARY

◆ reflectPoint()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE Plane< T, NDIMS >::PointType axom::primal::Plane< T, NDIMS >::reflectPoint ( const PointType x) const

Computes the reflection of a given point, x, across this Plane.

Parameters
[in]xbuffer consisting of the coordinates of the point to project.
Returns
refx the coordinates of the reflected point.
Postcondition
The reflected point will be on the Plane if x is on the Plane, otherwise it will be on the opposite side of the Plane from x.

◆ flip()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE void axom::primal::Plane< T, NDIMS >::flip

Flips the orientation of the plane.

◆ getOrientation()

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

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

References axom::utilities::isNearlyEqual(), axom::primal::ON_BOUNDARY, axom::primal::ON_NEGATIVE_SIDE, and axom::primal::ON_POSITIVE_SIDE.

◆ isValid()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE bool axom::primal::Plane< T, NDIMS >::isValid ( double  TOL = PRIMAL_TINY) const

Simple check for validity of a Plane.

Check that the normal is not the zero vector.

Parameters
[in]TOLuser-supplied tolerance. Optional. Default is 1.0e-50.
Returns
True, if the Plane is valid, False otherwise

References axom::utilities::isNearlyEqual().

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

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