HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_TransformUtil.h File Reference
#include "UT_API.h"
#include "UT_Array.h"
#include "UT_Assert.h"
#include "UT_Matrix3.h"
#include "UT_Matrix4.h"
#include "UT_Quaternion.h"
#include "UT_SmallArray.h"
#include "UT_Vector3.h"
#include "UT_Vector4.h"
#include <SYS/SYS_Math.h>
+ Include dependency graph for UT_TransformUtil.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  UT_SlerpCache< PREC >
 

Enumerations

enum  UT_ScaleInheritanceMode {
  UT_ScaleInheritanceMode::DEFAULT = 0, UT_ScaleInheritanceMode::OFFSET_ONLY, UT_ScaleInheritanceMode::OFFSET_AND_SCALE, UT_ScaleInheritanceMode::SCALE_ONLY,
  UT_ScaleInheritanceMode::IGNORE_PARENT_LOCAL
}
 Scale inheritance modes. More...
 
enum  UT_ParameterTransformMode { UT_ParameterTransformMode::MODE_PRE = 0, UT_ParameterTransformMode::MODE_POST, UT_ParameterTransformMode::MODE_OVERRIDE }
 
enum  UT_SLERP_METHOD { UT_SLERP_METHOD::NLERP, UT_SLERP_METHOD::ACCURATE }
 Method of slerp for blending. More...
 
enum  UT_SLERP_FLIP_METHOD { UT_SLERP_FLIP_METHOD::FIRST, UT_SLERP_FLIP_METHOD::SUCCESSIVE }
 Flip method for slerp to ensure consistency during blending. More...
 

Functions

template<typename PREC >
UT_Matrix4T< PREC > UTtransformCombineLocal (const UT_Matrix4T< PREC > &L, const UT_Matrix4T< PREC > &pW, const UT_Matrix4T< PREC > &pL, UT_ScaleInheritanceMode mode=UT_ScaleInheritanceMode::DEFAULT, UT_Matrix4T< PREC > *effective_local=nullptr)
 
template<typename PREC >
UT_Matrix4T< PREC > UTtransformExtractLocal (const UT_Matrix4T< PREC > &W, const UT_Matrix4T< PREC > &pW, const UT_Matrix4T< PREC > &pL, UT_ScaleInheritanceMode mode=UT_ScaleInheritanceMode::DEFAULT, UT_Matrix4T< PREC > *effective_local=nullptr)
 Extract relative transform with scale inheritance. More...
 
template<typename PREC >
void UTtransformExtractLocal (UT_Matrix4T< PREC > &L, const UT_Matrix4T< PREC > &W, const UT_Matrix4T< PREC > &pW, const UT_Matrix4T< PREC > &pW_inv, const UT_Matrix4T< PREC > &pL, UT_ScaleInheritanceMode mode, UT_Matrix4T< PREC > *effective_local)
 Extract relative transform with scale inheritance. More...
 
template<typename PREC , bool NORMALIZE_WEIGHTS = true, UT_SLERP_METHOD METHOD = UT_SLERP_METHOD::ACCURATE, UT_SLERP_FLIP_METHOD FLIP_METHOD = UT_SLERP_FLIP_METHOD::SUCCESSIVE>
UT_Matrix4T< PREC > UTslerp (const UT_Array< UT_Matrix4T< PREC >> &xforms, const UT_Array< PREC > &input_weights)
 Spherically blend transforms by decomposing into separate quaternions. More...
 
template<typename PREC , UT_SLERP_METHOD METHOD = UT_SLERP_METHOD::ACCURATE, UT_SLERP_FLIP_METHOD FLIP_METHOD = UT_SLERP_FLIP_METHOD::SUCCESSIVE>
UT_Matrix4T< PREC > UTslerp (const UT_Matrix4T< PREC > &xform0, const UT_Matrix4T< PREC > &xform1, const PREC input_weight)
 Spherically blend 2 transforms by decomposing into separate quaternions. More...
 
template<typename PREC , UT_SLERP_METHOD METHOD = UT_SLERP_METHOD::ACCURATE, UT_SLERP_FLIP_METHOD FLIP_METHOD = UT_SLERP_FLIP_METHOD::SUCCESSIVE>
UT_Matrix4T< PREC > UTslerp (const UT_Matrix4T< PREC > &xform0, const UT_Matrix4T< PREC > &xform1, const PREC input_weight, UT_SlerpCache< PREC > *makerotcache)
 
template<typename PREC >
void UTcombineParameterTransform (UT_Matrix4T< PREC > &local, const UT_Vector3T< PREC > &parent_local_s, const UT_XformOrder &adjust_ord, const UT_Vector3T< PREC > &parm_t, const UT_Vector3T< PREC > &parm_r, const UT_Vector3T< PREC > &parm_s, const UT_Vector3T< PREC > &parm_p, const UT_Vector3T< PREC > &parm_pr, const UT_ScaleInheritanceMode scalecomp, const UT_ParameterTransformMode mode)
 
template<typename PREC >
void UTextractParameterTransform (const UT_Matrix4T< PREC > &local, const UT_Matrix4T< PREC > &inputlocal, const UT_XformOrder &parmorder, const UT_ScaleInheritanceMode scalecomp, const UT_ParameterTransformMode mode, const UT_Vector3T< PREC > &parent_local_s, UT_Vector3T< PREC > &parm_t, UT_Vector3T< PREC > &parm_r, UT_Vector3T< PREC > &parm_s)
 

Detailed Description

Additional utilities for dealing with transforms

Definition in file UT_TransformUtil.h.

Enumeration Type Documentation

Enumerator
MODE_PRE 
MODE_POST 
MODE_OVERRIDE 

Definition at line 53 of file UT_TransformUtil.h.

Scale inheritance modes.

Enumerator
DEFAULT 

simple inheritance: W = L * pW

OFFSET_ONLY 

child doesn't scale with the parent local scales, but local translation is scaled: W = SR * pLS^-1 * T * pW (Maya segment scale compensation)

OFFSET_AND_SCALE 

local translation is scaled as before but parent local scaling is also reapplied by the child in local space: W = pLS * SR * pLS^-1 * T * pW (Softimage hierarchical scaling)

SCALE_ONLY 

local translation is not scaled, but parent local scaling is reapplied by the child in local space: W = pLS * SRT * pLS^-1 * pW

IGNORE_PARENT_LOCAL 

child completely ignores any parent local scaling: W = SRT * pLS^-1 * pW

Definition at line 29 of file UT_TransformUtil.h.

enum UT_SLERP_FLIP_METHOD
strong

Flip method for slerp to ensure consistency during blending.

Enumerator
FIRST 
SUCCESSIVE 

use hemisphere of first quaternion

Definition at line 100 of file UT_TransformUtil.h.

enum UT_SLERP_METHOD
strong

Method of slerp for blending.

Enumerator
NLERP 
ACCURATE 

normalized lerp of quaternion

Definition at line 93 of file UT_TransformUtil.h.

Function Documentation

template<typename PREC >
void UTcombineParameterTransform ( UT_Matrix4T< PREC > &  local,
const UT_Vector3T< PREC > &  parent_local_s,
const UT_XformOrder adjust_ord,
const UT_Vector3T< PREC > &  parm_t,
const UT_Vector3T< PREC > &  parm_r,
const UT_Vector3T< PREC > &  parm_s,
const UT_Vector3T< PREC > &  parm_p,
const UT_Vector3T< PREC > &  parm_pr,
const UT_ScaleInheritanceMode  scalecomp,
const UT_ParameterTransformMode  mode 
)
inline

Definition at line 750 of file UT_TransformUtil.h.

template<typename PREC >
void UTextractParameterTransform ( const UT_Matrix4T< PREC > &  local,
const UT_Matrix4T< PREC > &  inputlocal,
const UT_XformOrder parmorder,
const UT_ScaleInheritanceMode  scalecomp,
const UT_ParameterTransformMode  mode,
const UT_Vector3T< PREC > &  parent_local_s,
UT_Vector3T< PREC > &  parm_t,
UT_Vector3T< PREC > &  parm_r,
UT_Vector3T< PREC > &  parm_s 
)
inline

Definition at line 857 of file UT_TransformUtil.h.

template<typename PREC , bool NORMALIZE_WEIGHTS = true, UT_SLERP_METHOD METHOD = UT_SLERP_METHOD::ACCURATE, UT_SLERP_FLIP_METHOD FLIP_METHOD = UT_SLERP_FLIP_METHOD::SUCCESSIVE>
UT_Matrix4T< PREC > UTslerp ( const UT_Array< UT_Matrix4T< PREC >> &  xforms,
const UT_Array< PREC > &  input_weights 
)
inline

Spherically blend transforms by decomposing into separate quaternions.

Definition at line 402 of file UT_TransformUtil.h.

template<typename PREC , UT_SLERP_METHOD METHOD = UT_SLERP_METHOD::ACCURATE, UT_SLERP_FLIP_METHOD FLIP_METHOD = UT_SLERP_FLIP_METHOD::SUCCESSIVE>
UT_Matrix4T< PREC > UTslerp ( const UT_Matrix4T< PREC > &  xform0,
const UT_Matrix4T< PREC > &  xform1,
const PREC  input_weight 
)
inline

Spherically blend 2 transforms by decomposing into separate quaternions.

Definition at line 521 of file UT_TransformUtil.h.

template<typename PREC , UT_SLERP_METHOD METHOD = UT_SLERP_METHOD::ACCURATE, UT_SLERP_FLIP_METHOD FLIP_METHOD = UT_SLERP_FLIP_METHOD::SUCCESSIVE>
UT_Matrix4T< PREC > UTslerp ( const UT_Matrix4T< PREC > &  xform0,
const UT_Matrix4T< PREC > &  xform1,
const PREC  input_weight,
UT_SlerpCache< PREC > *  makerotcache 
)
inline

Spherically blend 2 transforms by decomposing into separate quaternions Also makes use of a cache to avoid calling makeRotationMatrix if the input matrices didn't change. 2 cache entries are used per invocation.

Definition at line 628 of file UT_TransformUtil.h.

template<typename PREC >
UT_Matrix4T< PREC > UTtransformCombineLocal ( const UT_Matrix4T< PREC > &  L,
const UT_Matrix4T< PREC > &  pW,
const UT_Matrix4T< PREC > &  pL,
UT_ScaleInheritanceMode  mode = UT_ScaleInheritanceMode::DEFAULT,
UT_Matrix4T< PREC > *  effective_local = nullptr 
)
inline

Combine a local transform on top of another with scale inheritance options L is modified to contain the effective local transform on return for t.

Parameters
pWlocal transform
pLparent world transform
modeparent local transform

Definition at line 157 of file UT_TransformUtil.h.

template<typename PREC >
UT_Matrix4T< PREC > UTtransformExtractLocal ( const UT_Matrix4T< PREC > &  W,
const UT_Matrix4T< PREC > &  pW,
const UT_Matrix4T< PREC > &  pL,
UT_ScaleInheritanceMode  mode = UT_ScaleInheritanceMode::DEFAULT,
UT_Matrix4T< PREC > *  effective_local = nullptr 
)
inline

Extract relative transform with scale inheritance.

Parameters
pWsource world transform
pLtarget parent world
modetarget parent local

Definition at line 380 of file UT_TransformUtil.h.

template<typename PREC >
void UTtransformExtractLocal ( UT_Matrix4T< PREC > &  L,
const UT_Matrix4T< PREC > &  W,
const UT_Matrix4T< PREC > &  pW,
const UT_Matrix4T< PREC > &  pW_inv,
const UT_Matrix4T< PREC > &  pL,
UT_ScaleInheritanceMode  mode = UT_ScaleInheritanceMode::DEFAULT,
UT_Matrix4T< PREC > *  effective_local = nullptr 
)
inline

Extract relative transform with scale inheritance.

Parameters
pWsource world transform
pW_invtarget parent world
pLtarget parent world
modetarget parent local

Definition at line 250 of file UT_TransformUtil.h.