Karma Engine
Loading...
Searching...
No Matches
Karma::FTransform Class Reference

#include <Transform.h>

Collaboration diagram for Karma::FTransform:

Public Member Functions

 FTransform (glm::vec3 rotation, glm::vec3 translation, glm::vec3 scale3D)
 
const glm::vec3 & GetLocation ()
 
const TRotatorGetRotation () const
 
const glm::vec3 & GetTranslation () const
 
const glm::vec3 & GetScale3D () const
 
void SetScale3D (const glm::vec3 &newScale)
 
void SetRotation (const TRotator &newRotation)
 
void SetTranslation (const glm::vec3 &newTranslation)
 
FTransform GetRelativeTransform (const FTransform &RelativeToWhat) const
 
FTransform operator* (const FTransform &Other) const
 
bool AnyHasNegativeScale (const glm::vec3 &InScale3D, const glm::vec3 &InOtherScale3D) const
 
glm::vec3 GetSafeScaleReciprocal (const glm::vec3 &InScale, float Tolerance) const
 
FORCEINLINE void CopyTranslation (const FTransform &Other)
 
FORCEINLINE void CopyRotation (const FTransform &Other)
 
FORCEINLINE void CopyScale3D (const FTransform Other)
 

Static Public Member Functions

static FTransform Identity ()
 
static void Multiply (FTransform *OutTransform, const FTransform *A, const FTransform *B)
 

Static Public Attributes

static FTransform m_Identity = FTransform()
 

Detailed Description

Transform composed of Scale, Rotation (as a quaternion), and Translation.

Transforms can be used to convert from one space to another, for example by transforming positions and directions from local space to world space.

Transformation of position vectors is applied in the order: Scale -> Rotate -> Translate. Transformation of direction vectors is applied in the order: Scale -> Rotate.

Order matters when composing transforms: C = A * B will yield a transform C that logically first applies A then B to any subsequent transformation. Note that this is the opposite order of quaternion (TQuat<T>) multiplication.

Example: LocalToWorld = (DeltaRotation * LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = (LocalToWorld * DeltaRotation) will change rotation in world space by DeltaRotation.

Member Function Documentation

◆ CopyRotation()

FORCEINLINE void Karma::FTransform::CopyRotation ( const FTransform & Other)
inline

Copy rotation from another FTransform.

◆ CopyScale3D()

FORCEINLINE void Karma::FTransform::CopyScale3D ( const FTransform Other)
inline

Copy scale from another FTransform.

◆ CopyTranslation()

FORCEINLINE void Karma::FTransform::CopyTranslation ( const FTransform & Other)
inline

Copy translation from another FTransform.

◆ GetSafeScaleReciprocal()

glm::vec3 Karma::FTransform::GetSafeScaleReciprocal ( const glm::vec3 & InScale,
float Tolerance ) const
inline

Mathematically if you have 0 scale, it should be infinite, however, in practice if you have 0 scale, and relative transform doesn't make much sense anymore because you should be instead of showing gigantic infinite mesh also returning BIG_NUMBER causes sequential NaN issues by multiplying so we hardcode as 0

◆ Multiply()

void Karma::FTransform::Multiply ( FTransform * OutTransform,
const FTransform * A,
const FTransform * B )
inlinestatic

Create a new transform: OutTransform = A * B.

Order matters when composing transforms : A * B will yield a transform that logically first applies A then B to any subsequent transformation.

Parameters
OutTransformpointer to transform that will store the result of A * B.
ATransform A.
BTransform B.

Returns Multiplied Transform of 2 FTransforms

◆ operator*()

FTransform Karma::FTransform::operator* ( const FTransform & Other) const

Return a transform that is the result of this multiplied by another transform. Order matters when composing transforms : C = A * B will yield a transform C that logically first applies A then B to any subsequent transformation.

Parameters
Otherother transform by which to multiply.
Returns
new transform: this * Other

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