EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
EBGeometry::Affine3T< T > Struct Template Reference

An affine map of 3D space, x -> A x + b, with A stored by rows. More...

#include <EBGeometry_Affine.hpp>

Public Member Functions

Vec3T< T > operator() (const Vec3T< T > &a_point) const noexcept
 Apply the map.
 
Affine3T then (const Affine3T &a_next) const noexcept
 The map that applies this one and then a_next.
 
bool isAxisAligned () const noexcept
 Whether every row of A has at most one non-zero entry, so that the map sends axis-aligned boxes to axis-aligned boxes exactly.
 
BoundingVolumes::AABBT< T > transform (const BoundingVolumes::AABBT< T > &a_box) const noexcept
 A box enclosing the image of a box under the map.
 

Static Public Member Functions

static Affine3T identity () noexcept
 The identity map.
 
static Affine3T translation (const Vec3T< T > &a_shift) noexcept
 A translation.
 
static Affine3T rotation (const T a_degrees, const size_t a_axis) noexcept
 A rotation about a coordinate axis, counterclockwise seen from the positive end of the axis.
 
static Affine3T rotation (const T a_degrees, const Vec3T< T > &a_axis) noexcept
 A rotation about an arbitrary axis through the origin, counterclockwise seen from the positive end of the axis (Rodrigues' formula).
 
static Affine3T scaling (const T a_factor) noexcept
 A uniform scaling.
 
static Affine3T reflection (const size_t a_axis) noexcept
 A reflection in a coordinate plane through the origin.
 

Public Attributes

Vec3T< T > m_row0
 First row of A.
 
Vec3T< T > m_row1
 Second row of A.
 
Vec3T< T > m_row2
 Third row of A.
 
Vec3T< T > m_shift
 The shift b.
 

Detailed Description

template<class T>
struct EBGeometry::Affine3T< T >

An affine map of 3D space, x -> A x + b, with A stored by rows.

A plain, trivially copyable value type. The factory functions build the maps the transforms need; then() composes two maps. Value-initialized (Affine3T<T>{}), it is the zero map, not the identity: use identity().

Template Parameters
TFloating-point precision.

Member Function Documentation

◆ identity()

template<class T >
static Affine3T EBGeometry::Affine3T< T >::identity ( )
inlinestaticnoexcept

The identity map.

Returns
x -> x.

◆ isAxisAligned()

template<class T >
bool EBGeometry::Affine3T< T >::isAxisAligned ( ) const
inlinenoexcept

Whether every row of A has at most one non-zero entry, so that the map sends axis-aligned boxes to axis-aligned boxes exactly.

Returns
True for translations, scalings, reflections and quarter-turn rotations.

◆ operator()()

template<class T >
Vec3T< T > EBGeometry::Affine3T< T >::operator() ( const Vec3T< T > &  a_point) const
inlinenoexcept

Apply the map.

Parameters
[in]a_pointPoint.
Returns
A a_point + b.

◆ reflection()

template<class T >
static Affine3T EBGeometry::Affine3T< T >::reflection ( const size_t  a_axis)
inlinestaticnoexcept

A reflection in a coordinate plane through the origin.

Parameters
[in]a_axisAxis normal to the plane (0, 1 or 2); that coordinate changes sign.
Returns
x -> x with component a_axis negated.

◆ rotation() [1/2]

template<class T >
static Affine3T EBGeometry::Affine3T< T >::rotation ( const T  a_degrees,
const size_t  a_axis 
)
inlinestaticnoexcept

A rotation about a coordinate axis, counterclockwise seen from the positive end of the axis.

Parameters
[in]a_degreesAngle in degrees.
[in]a_axisCoordinate axis (0, 1 or 2).
Returns
x -> R x.

◆ rotation() [2/2]

template<class T >
static Affine3T EBGeometry::Affine3T< T >::rotation ( const T  a_degrees,
const Vec3T< T > &  a_axis 
)
inlinestaticnoexcept

A rotation about an arbitrary axis through the origin, counterclockwise seen from the positive end of the axis (Rodrigues' formula).

Parameters
[in]a_degreesAngle in degrees.
[in]a_axisAxis direction; need not be normalized, must not be zero.
Returns
x -> R x.

◆ scaling()

template<class T >
static Affine3T EBGeometry::Affine3T< T >::scaling ( const T  a_factor)
inlinestaticnoexcept

A uniform scaling.

Parameters
[in]a_factorScale factor.
Returns
x -> a_factor x.

◆ then()

template<class T >
Affine3T EBGeometry::Affine3T< T >::then ( const Affine3T< T > &  a_next) const
inlinenoexcept

The map that applies this one and then a_next.

Parameters
[in]a_nextMap to apply second.
Returns
x -> a_next(this(x)).

◆ transform()

template<class T >
BoundingVolumes::AABBT< T > EBGeometry::Affine3T< T >::transform ( const BoundingVolumes::AABBT< T > &  a_box) const
inlinenoexcept

A box enclosing the image of a box under the map.

Exact for an axis-aligned map, which also keeps an unbounded box unbounded only along the axes it maps an unbounded axis to. For any other map, a bounded box's image is enclosed by the box around its eight transformed corners, and an unbounded box gives an unbounded box. Coordinates saturate at plus or minus Math::Limits<T>::max(). An empty box stays empty.

Parameters
[in]a_boxBox.
Returns
Box enclosing the image.

◆ translation()

template<class T >
static Affine3T EBGeometry::Affine3T< T >::translation ( const Vec3T< T > &  a_shift)
inlinestaticnoexcept

A translation.

Parameters
[in]a_shiftShift.
Returns
x -> x + a_shift.

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