Class Transform

Class Documentation

class Transform

The Transform class supports rigid transforms with only translation and rotation and no scaling/shear. It can be used in combination with Vector3, Quaternion and Matrix3x3 linear algebra classes.

Public Functions

inline Transform()

No initialization constructor.

inline explicit TF2SIMD_FORCE_INLINE Transform(const Quaternion &q, const Vector3 &c = Vector3(tf2Scalar(0), tf2Scalar(0), tf2Scalar(0)))

Constructor from Quaternion (optional Vector3 )

Parameters:
  • q – Rotation from quaternion

  • c – Translation from Vector (default 0,0,0)

inline explicit TF2SIMD_FORCE_INLINE Transform(const Matrix3x3 &b, const Vector3 &c = Vector3(tf2Scalar(0), tf2Scalar(0), tf2Scalar(0)))

Constructor from Matrix3x3 (optional Vector3)

Parameters:
  • b – Rotation from Matrix

  • c – Translation from Vector default (0,0,0)

inline TF2SIMD_FORCE_INLINE Transform(const Transform &other)

Copy constructor.

inline TF2SIMD_FORCE_INLINE Transform & operator= (const Transform &other)

Assignment Operator.

inline TF2SIMD_FORCE_INLINE void mult (const Transform &t1, const Transform &t2)

Set the current transform as the value of the product of two transforms.

Parameters:
inline TF2SIMD_FORCE_INLINE Vector3 operator() (const Vector3 &x) const

Return the transform of the vector.

inline TF2SIMD_FORCE_INLINE Vector3 operator* (const Vector3 &x) const

Return the transform of the vector.

inline TF2SIMD_FORCE_INLINE Quaternion operator* (const Quaternion &q) const

Return the transform of the Quaternion.

inline TF2SIMD_FORCE_INLINE Matrix3x3 & getBasis ()

Return the basis matrix for the rotation.

inline TF2SIMD_FORCE_INLINE const Matrix3x3 & getBasis () const

Return the basis matrix for the rotation.

inline TF2SIMD_FORCE_INLINE Vector3 & getOrigin ()

Return the origin vector translation.

inline TF2SIMD_FORCE_INLINE const Vector3 & getOrigin () const

Return the origin vector translation.

inline Quaternion getRotation() const

Return a quaternion representing the rotation.

inline void setFromOpenGLMatrix(const tf2Scalar *m)

Set from an array.

Parameters:

m – A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation

inline void getOpenGLMatrix(tf2Scalar *m) const

Fill an array representation.

Parameters:

m – A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation

inline TF2SIMD_FORCE_INLINE void setOrigin (const Vector3 &origin)

Set the translational element.

Parameters:

origin – The vector to set the translation to

TF2SIMD_FORCE_INLINE Vector3 invXform (const Vector3 &inVec) const
inline TF2SIMD_FORCE_INLINE void setBasis (const Matrix3x3 &basis)

Set the rotational element by Matrix3x3.

inline TF2SIMD_FORCE_INLINE void setRotation (const Quaternion &q)

Set the rotational element by Quaternion.

inline void setIdentity()

Set this transformation to the identity.

inline Transform &operator*=(const Transform &t)

Multiply this Transform by another(this = this * another)

Parameters:

t – The other transform

inline Transform inverse() const

Return the inverse of this transform.

Transform inverseTimes(const Transform &t) const

Return the inverse of this transform times the other transform.

Parameters:

t – The other transform return this.inverse() * the other

Transform operator*(const Transform &t) const

Return the product of this transform and the other.

void serialize(struct TransformData &dataOut) const
void serializeFloat(struct TransformFloatData &dataOut) const
void deSerialize(const struct TransformData &dataIn)
void deSerializeDouble(const struct TransformDoubleData &dataIn)
void deSerializeFloat(const struct TransformFloatData &dataIn)

Public Static Functions

static inline const Transform &getIdentity()

Return an identity transform.