Class SimTran#

Class Documentation#

class SimTran#

Similarity transform consisting of translation, rotation, and uniform scale factor.

Public Functions

SimTran()#

Default constructor.

SimTran(const HomTran &transform)#

Constructor with only homogeneous transform.

Parameters:

transform – Homogeneous transform with translation and rotation.

SimTran(double scale)#

Constructor with only scale.

Parameters:

scale – Scale factor.

SimTran(const HomTran &transform, double scale)#

Constructor with both homogeneous transform and scale.

Parameters:
  • transform – Homogeneous transform with translation and rotation.

  • scale – Scale factor.

SimTran(const SimTran &T)#

Copy constructor.

Parameters:

T – Other SimTran to copy from.

SimTran &operator=(const SimTran &T)#

Copy assignment operator.

Parameters:

T – Other SimTran to copy from.

Returns:

Reference to this object.

SimTran(SimTran &&T) noexcept#

Move constructor.

Parameters:

TSimTran to move from.

SimTran &operator=(SimTran &&T) noexcept#

Move assignment operator.

Parameters:

TSimTran to move from.

Returns:

Reference to this object.

bool operator==(const SimTran &other) const#

Equality operator.

Parameters:

otherSimTran to compare with.

Returns:

True if equal, false otherwise.

bool isApprox(const SimTran &other, double prec = MATH_EPSILON) const#

Approximate equality check.

Parameters:
  • otherSimTran to compare with.

  • prec – Precision threshold.

Returns:

True if approximately equal, false otherwise.

std::string typeString() const#

Get the type string of this class.

Returns:

“SimTran”

void setTranslation(const Vec3 &vec, double epsilon = MATH_EPSILON)#

Set the translation vector.

Parameters:
  • vec – Translation vector.

  • epsilon – Precision threshold used to check if the translation is zero.

std::string dumpString(std::string_view prefix = "", unsigned int precision = 6, bool exponential = false) const#

Get a string representation of the SimTran.

Parameters:
  • prefix – String prefix for each line.

  • precision – Number of digits to use for floating point values.

  • exponential – Use exponential notation if true.

Returns:

String with information about this SimTran.

void dump(std::string_view prefix = "", unsigned int precision = 10, bool exponential = false) const#

Print dumpString to std::cout.

Parameters:
  • prefix – String prefix for each line.

  • precision – Number of digits to use for floating point values.

  • exponential – Use exponential notation if true.

void setUnitQuaternion(const UnitQuaternion &q, double epsilon = MATH_EPSILON)#

Set the rotation using a unit quaternion.

Parameters:
  • q – Unit quaternion.

  • epsilon – Precision threshold to check if the unit quaternion is identity.

void setScale(double scale)#

Set the scale factor.

Parameters:

scale – Scale value.

const Mat44 getMatrix() const#

Get the full 4x4 transformation matrix.

Returns:

4x4 transformation matrix.

const Vec3 &getTranslation() const#

Get the translation vector.

Returns:

Translation vector.

const UnitQuaternion &getUnitQuaternion() const#

Get the rotation of the SimTran as a unit quaternion.

Returns:

Unit quaternion.

double getScale() const#

Get the scale factor.

Returns:

Scale factor.

void setIdentity()#

Set the SimTran to identity.

bool isIdentity() const#

Check if the SimTran is identity.

Returns:

True if identity, false otherwise.

bool hasTranslation() const#

Check if the SimTran has a non-zero translation.

Returns:

True if translation is non-zero, false otherwise.

bool hasRotation() const#

Check if the SimTran has a rotation.

Returns:

True if unit quaternion is non-identity, false otherwise.

bool hasScale() const#

Check if the SimTran includes a scale.

Returns:

True if scale is not 1.0, false otherwise.

SimTran operator*(const SimTran &T) const#

Compose this SimTran with another.

Parameters:

T – Another SimTran to apply after this one.

Returns:

Combined transform.

Vec3 operator*(const Vec3 &v) const#

Transform a vector by this SimTran.

Parameters:

v – Vector to transform.

Returns:

Transformed vector.

SimTran inverse() const#

Get the inverse of this SimTran.

Returns:

Inverse SimTran.

void makeNotReady()#

Mark this SimTran as not ready.

bool isReady()#

Check whether this SimTran is initialized.

Returns:

True if initialized, false otherwise.