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

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/primal/geometry/Segment.hpp>

Public Types

enum  { NUM_SEG_VERTS = 2 }
 
using PointType = Point< T, NDIMS >
 
using VectorType = Vector< T, NDIMS >
 

Public Member Functions

 Segment ()=default
 
AXOM_HOST_DEVICE Segment (const PointType &A, const PointType &B)
 Creates a segment instance from point A to point B. More...
 
AXOM_HOST_DEVICE const PointTypesource () const
 Returns the source point of the segment. More...
 
AXOM_HOST_DEVICE const PointTypetarget () const
 Returns the target point of the segment. More...
 
AXOM_HOST_DEVICE PointTypeoperator[] (int idx)
 Index operator to get the i^th vertex. More...
 
AXOM_HOST_DEVICE const PointTypeoperator[] (int idx) const
 Index operator to get the i^th vertex. More...
 
AXOM_HOST_DEVICE PointType at (const T &t) const
 Returns a point \( (1 - t)A + tB \). More...
 
double length () const
 Returns the length of the segment. More...
 
template<int TDIM = NDIMS>
std::enable_if< TDIM==2, VectorType >::type normal () const
 Returns a vector normal to the segment. More...
 
std::ostream & print (std::ostream &os) const
 Simple formatted print of a segment instance. More...
 

Friends

bool operator== (const Segment &lhs, const Segment &rhs)
 Equality comparison operator for segments. More...
 
bool operator!= (const Segment &lhs, const Segment &rhs)
 Inequality operator for segments. More...
 

Member Typedef Documentation

◆ PointType

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

◆ VectorType

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

Member Enumeration Documentation

◆ anonymous enum

template<typename T , int NDIMS>
anonymous enum
Enumerator
NUM_SEG_VERTS 

Constructor & Destructor Documentation

◆ Segment() [1/2]

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

◆ Segment() [2/2]

template<typename T , int NDIMS>
AXOM_HOST_DEVICE axom::primal::Segment< T, NDIMS >::Segment ( const PointType A,
const PointType B 
)
inline

Creates a segment instance from point A to point B.

Parameters
Auser-supplied source point
Buser-supplied target point

Member Function Documentation

◆ source()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE const PointType& axom::primal::Segment< T, NDIMS >::source ( ) const
inline

Returns the source point of the segment.

Returns
s the source point of the segment.

◆ target()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE const PointType& axom::primal::Segment< T, NDIMS >::target ( ) const
inline

Returns the target point of the segment.

Returns
t the target point of the segment.

◆ operator[]() [1/2]

template<typename T , int NDIMS>
AXOM_HOST_DEVICE PointType& axom::primal::Segment< T, NDIMS >::operator[] ( int  idx)
inline

Index operator to get the i^th vertex.

Parameters
idxThe index of the desired vertex
Precondition
idx is 0 or 1

References axom::primal::Segment< T, NDIMS >::NUM_SEG_VERTS, and SLIC_ASSERT.

◆ operator[]() [2/2]

template<typename T , int NDIMS>
AXOM_HOST_DEVICE const PointType& axom::primal::Segment< T, NDIMS >::operator[] ( int  idx) const
inline

Index operator to get the i^th vertex.

Parameters
idxThe index of the desired vertex
Precondition
idx is 0 or 1

References axom::primal::Segment< T, NDIMS >::NUM_SEG_VERTS, and SLIC_ASSERT.

◆ at()

template<typename T , int NDIMS>
AXOM_HOST_DEVICE PointType axom::primal::Segment< T, NDIMS >::at ( const T &  t) const
inline

Returns a point \( (1 - t)A + tB \).

Parameters
[in]tuser-supplied parameter for blending A and B
Postcondition
Return point P will always be collinear with the segment's start point A and end point B.
If \( t = 0, \) the return point \( P = A. \)
If \( t = 1, \) the return point \( P = B. \)

References axom::primal::Point< T, NDIMS >::lerp().

◆ length()

template<typename T , int NDIMS>
double axom::primal::Segment< T, NDIMS >::length ( ) const
inline

Returns the length of the segment.

◆ normal()

template<typename T , int NDIMS>
template<int TDIM = NDIMS>
std::enable_if<TDIM == 2, VectorType>::type axom::primal::Segment< T, NDIMS >::normal ( ) const
inline

Returns a vector normal to the segment.

Note
Only available in 2D

◆ print()

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

Simple formatted print of a segment instance.

Parameters
osThe output stream to write to
Returns
A reference to the modified ostream

Friends And Related Function Documentation

◆ operator==

template<typename T , int NDIMS>
bool operator== ( const Segment< T, NDIMS > &  lhs,
const Segment< T, NDIMS > &  rhs 
)
friend

Equality comparison operator for segments.

◆ operator!=

template<typename T , int NDIMS>
bool operator!= ( const Segment< T, NDIMS > &  lhs,
const Segment< T, NDIMS > &  rhs 
)
friend

Inequality operator for segments.


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