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>

Public Types

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

Public Member Functions

AXOM_HOST_DEVICE int getDimension () const
 Returns the dimension of the Plane. More...
 
AXOM_HOST_DEVICE const VectorTypegetNormal () const
 Returns a const pointer to the plane's unit normal. 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...
 
PointType projectPoint (const PointType &x) const
 Computes the projection of a given point, x, onto this Plane. More...
 
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...
 
std::ostream & print (std::ostream &os) const
 Prints the Plane information in the given output stream. More...
 
Constructors
AXOM_HOST_DEVICE Plane (const VectorType &normal, const PointType &x)
 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)
 Constructs a plane with a specified normal, \( \mathcal{N} \), located at the given offset from origin. 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 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

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/2]

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

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

◆ Plane() [2/2]

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

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

Member Function Documentation

◆ getDimension()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE 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>
AXOM_HOST_DEVICE const VectorType& axom::primal::Plane< T, NDIMS >::getNormal ( ) const
inline

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

Returns
N the unit normal.

◆ 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>
Plane< T, NDIMS >::PointType axom::primal::Plane< T, NDIMS >::projectPoint ( const PointType x) 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.
Returns
projx the coordinates of the projected point.
Postcondition
this->getOrientedSide( projx ) == ON_BOUNDARY

◆ flip()

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

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

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

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