Transform

Api for transforms with rotation, scale and translation

Namespace: dmTransform
Include: #include <>
STRUCTS
struct Transform Transform with non-uniform (3-component) scale
FUNCTIONS
dmVMath::Point3 Apply(dmTransform::Transform& t, dmVMath::Point3& p) Apply the transform on a point (includes the trans...
dmVMath::Vector3 Apply(dmTransform::Transform& t, dmVMath::Vector3& v) Apply the transform on a vector (excludes the tran...
dmVMath::Point3 ApplyNoScaleZ(dmTransform::Transform& t, dmVMath::Point3& p) Apply the transform on a point, but without scalin...
dmVMath::Vector3 ApplyNoScaleZ(dmTransform::Transform& t, dmVMath::Vector3& v) Apply the transform on a vector, but without scali...
 ExtractScale( mtx) Extract the absolute values of the scale component...
dmVMath::Quat GetRotation() get rotatiom
dmVMath::Vector3 GetScale() get scale
dmVMath::Vector3 GetTranslation() get translation
float GetUniformScale() Compute a 'uniform' scale for this transform. In t...
dmTransform::Transform Inv(const dmTransform::Transform& t) Invert a transform
dmTransform::Transform Mul(const dmTransform::Transform& lhs, const dmTransform::Transform& rhs) Transforms the right-hand transform by the left-ha...
dmTransform::Transform MulNoScaleZ(const dmTransform::Transform& lhs, const dmTransform::Transform& rhs) Transforms the right-hand transform by the left-ha...
dmVMath::Matrix MulNoScaleZ(const dmVMath::Matrix& m1, const dmVMath::Matrix& m2) Multiply two matrices without z-scaling the transl...
void NormalizeZScale( mtx) Eliminate the z scaling components in a matrix
void NormalizeZScale(const dmVMath::Matrix& source, dmVMath::Matrix* target) Eliminate the z scaling components in a matrix
 ResetScale( mtx) Eliminate the scaling components in a matrix
void SetIdentity() initialize to identity transform
void SetRotation(dmVMath::Quat rotation) set rotatiom
dmVMath::Vector3 SetScale() set scale
void SetTranslation(dmVMath::Vector3 translation) set translation
void SetUniformScale(float scale) set uniform scale
 ToMatrix4( t) Convert a transform into a 4-dim matrix
 ToTransform( mtx) Convert a matrix into a transform
void Transform() Constructor. Leaves the struct in an uninitialized...
void Transform(dmVMath::Vector3 translation, dmVMath::Quat rotation, dmVMath::Vector3 scale) constructor
void Transform(dmVMath::Vector3 translation, dmVMath::Quat rotation, dmVMath::Vector3 scale) constructor

Functions

Apply

dmVMath::Point3 Apply(dmTransform::Transform& t, dmVMath::Point3& p)

Apply the transform on a point (includes the transform translation).

PARAMETERS

dmTransform::Transform& t Transform
dmVMath::Point3& p Point

RETURNS

dmVMath::Point3 Transformed point

Apply

dmVMath::Vector3 Apply(dmTransform::Transform& t, dmVMath::Vector3& v)

Apply the transform on a vector (excludes the transform translation).

PARAMETERS

dmTransform::Transform& t Transform
dmVMath::Vector3& v Vector

RETURNS

dmVMath::Vector3 Transformed vector

ApplyNoScaleZ

dmVMath::Point3 ApplyNoScaleZ(dmTransform::Transform& t, dmVMath::Point3& p)

Apply the transform on a point, but without scaling the Z-component of the point (includes the transform translation).

PARAMETERS

dmTransform::Transform& t Transform
dmVMath::Point3& p Point

RETURNS

dmVMath::Point3 Transformed point

ApplyNoScaleZ

dmVMath::Vector3 ApplyNoScaleZ(dmTransform::Transform& t, dmVMath::Vector3& v)

Apply the transform on a vector, but without scaling the Z-component of the vector (excludes the transform translation).

PARAMETERS

dmTransform::Transform& t Transform
dmVMath::Vector3& v Vector

RETURNS

dmVMath::Vector3 Transformed vector

ExtractScale

 ExtractScale( mtx)

Extract the absolute values of the scale component from a matrix.

PARAMETERS

mtx Source matrix

RETURNS

with scale values for x,y,z

GetRotation

dmVMath::Quat GetRotation()

get rotatiom

PARAMETERS

RETURNS

dmVMath::Quat

GetScale

dmVMath::Vector3 GetScale()

get scale

PARAMETERS

RETURNS

dmVMath::Vector3

GetTranslation

dmVMath::Vector3 GetTranslation()

get translation

PARAMETERS

RETURNS

dmVMath::Vector3

GetUniformScale

float GetUniformScale()

Compute a 'uniform' scale for this transform. In the event that the scale applied to this transform is not uniform then the value is arbitrary: we make a selection that will not introduce any floating point rounding errors.

PARAMETERS

RETURNS

float the uniform scale associated with this transform.

Inv

dmTransform::Transform Inv(const dmTransform::Transform& t)

Invert a transform

PARAMETERS

const dmTransform::Transform& t

RETURNS

dmTransform::Transform inverted transform

Mul

dmTransform::Transform Mul(const dmTransform::Transform& lhs, const dmTransform::Transform& rhs)

Transforms the right-hand transform by the left-hand transform

PARAMETERS

const dmTransform::Transform& lhs
const dmTransform::Transform& rhs

RETURNS

dmTransform::Transform Transformed transform

MulNoScaleZ

dmTransform::Transform MulNoScaleZ(const dmTransform::Transform& lhs, const dmTransform::Transform& rhs)

Transforms the right-hand transform by the left-hand transform, without scaling the Z-component of the transition of the transformed transform

PARAMETERS

const dmTransform::Transform& lhs
const dmTransform::Transform& rhs

RETURNS

dmTransform::Transform Transformed transform

MulNoScaleZ

dmVMath::Matrix MulNoScaleZ(const dmVMath::Matrix& m1, const dmVMath::Matrix& m2)

Multiply two matrices without z-scaling the translation in m2

PARAMETERS

const dmVMath::Matrix& m1 First matrix
const dmVMath::Matrix& m2 Second matrix

RETURNS

dmVMath::Matrix The resulting transform

NormalizeZScale

void NormalizeZScale( mtx)

Eliminate the z scaling components in a matrix

PARAMETERS

mtx Matrix to operate on

NormalizeZScale

void NormalizeZScale(const dmVMath::Matrix& source, dmVMath::Matrix* target)

Eliminate the z scaling components in a matrix

PARAMETERS

const dmVMath::Matrix& source Source matrix
dmVMath::Matrix* target Target matrix

ResetScale

 ResetScale( mtx)

Eliminate the scaling components in a matrix

PARAMETERS

mtx Matrix to operate on

RETURNS

containing the scaling by component

SetIdentity

void SetIdentity()

initialize to identity transform

PARAMETERS


SetRotation

void SetRotation(dmVMath::Quat rotation)

set rotatiom

PARAMETERS

dmVMath::Quat rotation

SetScale

dmVMath::Vector3 SetScale()

set scale

PARAMETERS

RETURNS

dmVMath::Vector3

SetTranslation

void SetTranslation(dmVMath::Vector3 translation)

set translation

PARAMETERS

dmVMath::Vector3 translation

SetUniformScale

void SetUniformScale(float scale)

set uniform scale

PARAMETERS

float scale

ToMatrix4

 ToMatrix4( t)

Convert a transform into a 4-dim matrix

PARAMETERS

t Transform to convert

RETURNS

representing the same transform

ToTransform

 ToTransform( mtx)

Convert a matrix into a transform

PARAMETERS

mtx Matrix4 to convert

RETURNS

representing the same transform

Transform

void Transform()

Constructor. Leaves the struct in an uninitialized state

PARAMETERS


Transform

void Transform(dmVMath::Vector3 translation, dmVMath::Quat rotation, dmVMath::Vector3 scale)

constructor

PARAMETERS

dmVMath::Vector3 translation
dmVMath::Quat rotation
dmVMath::Vector3 scale

Transform

void Transform(dmVMath::Vector3 translation, dmVMath::Quat rotation, dmVMath::Vector3 scale)

constructor

PARAMETERS

dmVMath::Vector3 translation
dmVMath::Quat rotation
dmVMath::Vector3 scale

Structs

Transform

TYPE

struct Transform

Transform with non-uniform (3-component) scale. Transform applied as: T(p) = translate(rotate(scale(p))) = p' The scale is non-rotated to avoid shearing in the transform. Two transforms are applied as: T1(T2(p)) = t1(r1(t2(r2(s1(s2(p)))))) = p' This means that the transform is not associative: T1(T2(p)) != (T1*T2)(P)