jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
jau::math::geom::plane::AffineTransform Class Reference

Represents a affine 2x3 transformation matrix in column major order (memory layout). More...

#include <affine_transform.hpp>

Collaboration diagram for jau::math::geom::plane::AffineTransform:

Public Member Functions

constexpr AffineTransform () noexcept
 Initialized to identity. More...
 
constexpr AffineTransform (AffineTransform &&o) noexcept=default
 
constexpr AffineTransform (const AffineTransform &o) noexcept=default
 
constexpr AffineTransform (const float m00_, const float m10_, const float m01_, const float m11_, const float m02_, const float m12_) noexcept
 
 AffineTransform (const float mat2xN[], const jau::nsize_t mat_len) noexcept
 
AffineTransformconcat (const AffineTransform &tR) noexcept
 Concatenates the given matrix to this. More...
 
AffineTransform createInverse () const
 
void deltaTransform (const float src[], float dst[], size_t length) const noexcept
 
float determinant () const noexcept
 
constexpr bool equals (const AffineTransform &o, const float epsilon=std::numeric_limits< float >::epsilon()) const noexcept
 
void getMatrix (float mat2xN[], const jau::nsize_t mat_len) const noexcept
 
AffineTransformType getType () const noexcept
 
void inverseTransform (const float src[], float dst[], size_t length) const
 
bool isIdentity () const noexcept
 
constexpr AffineTransformoperator= (AffineTransform &&) noexcept=default
 
constexpr AffineTransformoperator= (const AffineTransform &) noexcept=default
 
constexpr bool operator== (const AffineTransform &rhs) const noexcept
 
AffineTransformpreConcat (const AffineTransform &tL) noexcept
 Pre-concatenates the given matrix to this. More...
 
AABBox3fresizeBox (AABBox3f &box, const AABBox3f &newBox) noexcept
 Resize the aabbox3f to encapsulate another AABox, which will be transformed on the fly first. More...
 
AffineTransformrotate (const float angle, AffineTransform &tmp) noexcept
 
AffineTransformrotate (const float angle, const float px, const float py, AffineTransform &tmp) noexcept
 
AffineTransformscale (const float scx, const float scy, AffineTransform &tmp) noexcept
 
float scaleX () const noexcept
 
float scaleY () const noexcept
 
AffineTransformset (const float m00_, const float m10_, const float m01_, const float m11_, const float m02_, const float m12_) noexcept
 
AffineTransformsetToIdentity () noexcept
 
AffineTransformsetToRotation (const float angle) noexcept
 
AffineTransformsetToRotation (const float angle, const float px, const float py) noexcept
 
AffineTransformsetToScale (const float scx, const float scy) noexcept
 
AffineTransformsetToShear (const float shx, const float shy) noexcept
 
AffineTransformsetToTranslation (const float mx, const float my) noexcept
 
AffineTransformshear (const float shx, const float shy, AffineTransform &tmp) noexcept
 
float shearX () const noexcept
 
float shearY () const noexcept
 
std::string toString () const noexcept
 
AABBox3ftransform (const AABBox3f &src, AABBox3f &dst) const noexcept
 
float * transform (const float src[], float dst[]) const noexcept
 
void transform (const float src[], float dst[], size_t length) const noexcept
 
Vec2f transform (const Vec2f &src) const noexcept
 
Vec2ftransform (const Vec2f &src, Vec2f &dst) const noexcept
 
Vec3f transform (const Vec3f &src) const noexcept
 
Vec3ftransform (const Vec3f &src, Vec3f &dst) const noexcept
 
AffineTransformtranslate (const float mx, const float my, AffineTransform &tmp) noexcept
 
float translateX () const noexcept
 
float translateY () const noexcept
 

Static Public Member Functions

static AffineTransform mul (const AffineTransform &tL, const AffineTransform &tR) noexcept
 Multiply matrix of two AffineTransform objects. More...
 

Static Public Attributes

static constexpr const float ZERO = (float)1E-10
 The min absolute value equivalent to zero, aka EPSILON. More...
 

Detailed Description

Represents a affine 2x3 transformation matrix in column major order (memory layout).

Field notation row-column: m10 (row 1, column 0).

Definition at line 86 of file affine_transform.hpp.

Constructor & Destructor Documentation

◆ AffineTransform() [1/5]

constexpr jau::math::geom::plane::AffineTransform::AffineTransform ( )
inlineconstexprnoexcept

Initialized to identity.

Definition at line 113 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ AffineTransform() [2/5]

constexpr jau::math::geom::plane::AffineTransform::AffineTransform ( const float  m00_,
const float  m10_,
const float  m01_,
const float  m11_,
const float  m02_,
const float  m12_ 
)
inlineconstexprnoexcept

Definition at line 120 of file affine_transform.hpp.

◆ AffineTransform() [3/5]

jau::math::geom::plane::AffineTransform::AffineTransform ( const float  mat2xN[],
const jau::nsize_t  mat_len 
)
inlinenoexcept
Parameters
mat2xNeither a 2x2 or 2x3 matrix depending on mat_len
mat_leneither 6 for 2x3 matrix or 4 for 2x2 matrix

Definition at line 131 of file affine_transform.hpp.

◆ AffineTransform() [4/5]

constexpr jau::math::geom::plane::AffineTransform::AffineTransform ( const AffineTransform o)
constexprdefaultnoexcept

◆ AffineTransform() [5/5]

constexpr jau::math::geom::plane::AffineTransform::AffineTransform ( AffineTransform &&  o)
constexprdefaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

constexpr AffineTransform & jau::math::geom::plane::AffineTransform::operator= ( const AffineTransform )
constexprdefaultnoexcept

◆ operator=() [2/2]

constexpr AffineTransform & jau::math::geom::plane::AffineTransform::operator= ( AffineTransform &&  )
constexprdefaultnoexcept

◆ getType()

AffineTransformType jau::math::geom::plane::AffineTransform::getType ( ) const
inlinenoexcept

Definition at line 167 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ scaleX()

float jau::math::geom::plane::AffineTransform::scaleX ( ) const
inlinenoexcept

Definition at line 209 of file affine_transform.hpp.

◆ scaleY()

float jau::math::geom::plane::AffineTransform::scaleY ( ) const
inlinenoexcept

Definition at line 211 of file affine_transform.hpp.

◆ shearX()

float jau::math::geom::plane::AffineTransform::shearX ( ) const
inlinenoexcept

Definition at line 213 of file affine_transform.hpp.

◆ shearY()

float jau::math::geom::plane::AffineTransform::shearY ( ) const
inlinenoexcept

Definition at line 215 of file affine_transform.hpp.

◆ translateX()

float jau::math::geom::plane::AffineTransform::translateX ( ) const
inlinenoexcept

Definition at line 217 of file affine_transform.hpp.

◆ translateY()

float jau::math::geom::plane::AffineTransform::translateY ( ) const
inlinenoexcept

Definition at line 219 of file affine_transform.hpp.

◆ isIdentity()

bool jau::math::geom::plane::AffineTransform::isIdentity ( ) const
inlinenoexcept

Definition at line 221 of file affine_transform.hpp.

◆ getMatrix()

void jau::math::geom::plane::AffineTransform::getMatrix ( float  mat2xN[],
const jau::nsize_t  mat_len 
) const
inlinenoexcept
Parameters
mat2xNeither a 2x2 or 2x3 matrix depending on mat_len
mat_leneither 6 for 2x3 matrix or 4 for 2x2 matrix

Definition at line 227 of file affine_transform.hpp.

◆ determinant()

float jau::math::geom::plane::AffineTransform::determinant ( ) const
inlinenoexcept

Definition at line 238 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ set()

AffineTransform & jau::math::geom::plane::AffineTransform::set ( const float  m00_,
const float  m10_,
const float  m01_,
const float  m11_,
const float  m02_,
const float  m12_ 
)
inlinenoexcept

Definition at line 240 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ setToIdentity()

AffineTransform & jau::math::geom::plane::AffineTransform::setToIdentity ( )
inlinenoexcept

Definition at line 251 of file affine_transform.hpp.

◆ setToTranslation()

AffineTransform & jau::math::geom::plane::AffineTransform::setToTranslation ( const float  mx,
const float  my 
)
inlinenoexcept

Definition at line 258 of file affine_transform.hpp.

◆ setToScale()

AffineTransform & jau::math::geom::plane::AffineTransform::setToScale ( const float  scx,
const float  scy 
)
inlinenoexcept

Definition at line 271 of file affine_transform.hpp.

◆ setToShear()

AffineTransform & jau::math::geom::plane::AffineTransform::setToShear ( const float  shx,
const float  shy 
)
inlinenoexcept

Definition at line 283 of file affine_transform.hpp.

◆ setToRotation() [1/2]

AffineTransform & jau::math::geom::plane::AffineTransform::setToRotation ( const float  angle)
inlinenoexcept

Definition at line 296 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ setToRotation() [2/2]

AffineTransform & jau::math::geom::plane::AffineTransform::setToRotation ( const float  angle,
const float  px,
const float  py 
)
inlinenoexcept

Definition at line 314 of file affine_transform.hpp.

◆ translate()

AffineTransform & jau::math::geom::plane::AffineTransform::translate ( const float  mx,
const float  my,
AffineTransform tmp 
)
inlinenoexcept

Definition at line 322 of file affine_transform.hpp.

◆ scale()

AffineTransform & jau::math::geom::plane::AffineTransform::scale ( const float  scx,
const float  scy,
AffineTransform tmp 
)
inlinenoexcept

Definition at line 326 of file affine_transform.hpp.

◆ shear()

AffineTransform & jau::math::geom::plane::AffineTransform::shear ( const float  shx,
const float  shy,
AffineTransform tmp 
)
inlinenoexcept

Definition at line 330 of file affine_transform.hpp.

◆ rotate() [1/2]

AffineTransform & jau::math::geom::plane::AffineTransform::rotate ( const float  angle,
AffineTransform tmp 
)
inlinenoexcept

Definition at line 334 of file affine_transform.hpp.

◆ rotate() [2/2]

AffineTransform & jau::math::geom::plane::AffineTransform::rotate ( const float  angle,
const float  px,
const float  py,
AffineTransform tmp 
)
inlinenoexcept

Definition at line 338 of file affine_transform.hpp.

◆ mul()

static AffineTransform jau::math::geom::plane::AffineTransform::mul ( const AffineTransform tL,
const AffineTransform tR 
)
inlinestaticnoexcept

Multiply matrix of two AffineTransform objects.

Parameters
tL- the AffineTransform object is a multiplicand (left argument)
tR- the AffineTransform object is a multiplier (right argument)
Returns
A new AffineTransform object containing the result of [tL] X [tR].

Definition at line 349 of file affine_transform.hpp.

◆ concat()

AffineTransform & jau::math::geom::plane::AffineTransform::concat ( const AffineTransform tR)
inlinenoexcept

Concatenates the given matrix to this.

Implementations performs the matrix multiplication:

  [this] = [this] X [tR]
Parameters
tRthe right-argument of the matrix multiplication
Returns
this transform for chaining

Definition at line 370 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ preConcat()

AffineTransform & jau::math::geom::plane::AffineTransform::preConcat ( const AffineTransform tL)
inlinenoexcept

Pre-concatenates the given matrix to this.

Implementations performs the matrix multiplication:

  [this] = [tL] X [this]
Parameters
tLthe left-argument of the matrix multiplication
Returns
this transform for chaining

Definition at line 393 of file affine_transform.hpp.

◆ createInverse()

AffineTransform jau::math::geom::plane::AffineTransform::createInverse ( ) const
inline

Definition at line 405 of file affine_transform.hpp.

◆ transform() [1/7]

AABBox3f & jau::math::geom::plane::AffineTransform::transform ( const AABBox3f src,
AABBox3f dst 
) const
inlinenoexcept
Parameters
src
dst
Returns
dst for chaining

Definition at line 426 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ transform() [2/7]

float * jau::math::geom::plane::AffineTransform::transform ( const float  src[],
float  dst[] 
) const
inlinenoexcept
Parameters
src
dst
Returns
dst for chaining Vertex& transform(const Vertex& src, const Vertex& dst) const noexcept { const float x = src.x(); const float y = src.y(); dst.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12, src.z()); return dst; } void transform(const Vertex src[], const Vertex dst[], size_t length) const noexcept { size_t srcOff=0; size_t dstOff=0; while (–length >= 0) { const Vertex& srcPoint = src[srcOff++]; Vertex& dstPoint = dst[dstOff++]; const float x = srcPoint.x(); const float y = srcPoint.y(); dstPoint.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12, srcPoint.z()); } }
Parameters
srcfloat[2] source of transformation
dstfloat[2] destination of transformation, maybe be equal to src
Returns
dst for chaining

Definition at line 461 of file affine_transform.hpp.

◆ transform() [3/7]

void jau::math::geom::plane::AffineTransform::transform ( const float  src[],
float  dst[],
size_t  length 
) const
inlinenoexcept

Definition at line 469 of file affine_transform.hpp.

◆ transform() [4/7]

Vec2f & jau::math::geom::plane::AffineTransform::transform ( const Vec2f src,
Vec2f dst 
) const
inlinenoexcept
Parameters
srcsource of transformation
dstdestination of transformation, maybe be equal to src
Returns
dst for chaining

Definition at line 500 of file affine_transform.hpp.

◆ transform() [5/7]

Vec2f jau::math::geom::plane::AffineTransform::transform ( const Vec2f src) const
inlinenoexcept
Parameters
srcsource of transformation
Returns
resulting Vec2f

Definition at line 512 of file affine_transform.hpp.

◆ transform() [6/7]

Vec3f & jau::math::geom::plane::AffineTransform::transform ( const Vec3f src,
Vec3f dst 
) const
inlinenoexcept
Parameters
srcsource of transformation
dstdestination of transformation, maybe be equal to src
Returns
dst for chaining

Definition at line 524 of file affine_transform.hpp.

◆ transform() [7/7]

Vec3f jau::math::geom::plane::AffineTransform::transform ( const Vec3f src) const
inlinenoexcept
Parameters
srcsource of transformation
dstdestination of transformation, maybe be equal to src
Returns
resulting Vec3f

Definition at line 549 of file affine_transform.hpp.

◆ resizeBox()

AABBox3f & jau::math::geom::plane::AffineTransform::resizeBox ( AABBox3f box,
const AABBox3f newBox 
)
inlinenoexcept

Resize the aabbox3f to encapsulate another AABox, which will be transformed on the fly first.

Parameters
newBoxaabbox3f to be encapsulated in
tthe AffineTransform applied on newBox on the fly
tmpV3temporary storage
Returns
this aabbox3f for chaining

Definition at line 560 of file affine_transform.hpp.

◆ deltaTransform()

void jau::math::geom::plane::AffineTransform::deltaTransform ( const float  src[],
float  dst[],
size_t  length 
) const
inlinenoexcept
Parameters
src
dst
Returns
return dst for chaining Vertex& deltaTransform(const Vertex& src, Vertex& dst) const noexcept { const float x = src.x(); const float y = src.y(); dst.setCoord(x * m00 + y * m01, x * m10 + y * m11, src.z()); return dst; }

Definition at line 579 of file affine_transform.hpp.

◆ inverseTransform()

void jau::math::geom::plane::AffineTransform::inverseTransform ( const float  src[],
float  dst[],
size_t  length 
) const
inline
Parameters
src
dst
Returns
return dst for chaining
Exceptions
NoninvertibleTransformExceptionVertex& inverseTransform(const Vertex& src, Vertex& dst) const { const float det = getDeterminant(); if (std::abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); } const float x = src.x() - m02; const float y = src.y() - m12; dst.setCoord((x * m11 - y * m01) / det, (y * m00 - x * m10) / det, src.z()); return dst; }

Definition at line 607 of file affine_transform.hpp.

◆ toString()

std::string jau::math::geom::plane::AffineTransform::toString ( ) const
inlinenoexcept

Definition at line 622 of file affine_transform.hpp.

◆ equals()

constexpr bool jau::math::geom::plane::AffineTransform::equals ( const AffineTransform o,
const float  epsilon = std::numeric_limits<float>::epsilon() 
) const
inlineconstexprnoexcept

Definition at line 627 of file affine_transform.hpp.

Here is the caller graph for this function:

◆ operator==()

constexpr bool jau::math::geom::plane::AffineTransform::operator== ( const AffineTransform rhs) const
inlineconstexprnoexcept

Definition at line 639 of file affine_transform.hpp.

Member Data Documentation

◆ ZERO

constexpr const float jau::math::geom::plane::AffineTransform::ZERO = (float)1E-10
staticconstexpr

The min absolute value equivalent to zero, aka EPSILON.

Definition at line 110 of file affine_transform.hpp.


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