HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_XformOrder Class Reference

Transformation order of scales, rotates, and translates. More...

#include <UT_XformOrder.h>

Public Types

enum  xform {
  T =0, S =1, RX =2, RY =3,
  RZ =4
}
 
enum  rstOrder {
  TRS, TSR, RTS, RST,
  STR, SRT
}
 
enum  xyzOrder {
  XYZ, XZY, YXZ, YZX,
  ZXY, ZYX
}
 

Public Member Functions

 UT_XformOrder (rstOrder rst=UT_XformOrder::TSR, xyzOrder rot=UT_XformOrder::XYZ)
 
 UT_XformOrder (xform xf1, xform xf2, xform xf3=UT_XformOrder::RX, xform xf4=UT_XformOrder::RY, xform xf5=UT_XformOrder::RZ)
 
 UT_XformOrder (const char *rst, const char *rot="xyz")
 
 UT_XformOrder (const UT_XformOrder &xf)=default
 
UT_XformOrderoperator= (const UT_XformOrder &xf)=default
 
void swap (UT_XformOrder::xform xf1, UT_XformOrder::xform xf2)
 Swap two xform components. More...
 
void invert ()
 Reverse the order. More...
 
int count () const
 
bool operator== (const UT_XformOrder &order) const
 
bool operator!= (const UT_XformOrder &order) const
 
bool isScaleBeforeRotate () const
 Returns true if order says scales are before rotates. More...
 
int save (std::ostream &os, int binary=0) const
 
void reorder (UT_XformOrder::xform xf1, UT_XformOrder::xform xf2, UT_XformOrder::xform xf3, UT_XformOrder::xform xf4, UT_XformOrder::xform xf5)
 
void reorder (UT_XformOrder::rstOrder rst, UT_XformOrder::xyzOrder rot)
 
UT_XformOrder::rstOrder mainOrder () const
 
void mainOrder (UT_XformOrder::rstOrder rst)
 
bool mainOrder (const char *rst)
 
UT_XformOrder::xyzOrder rotOrder () const
 
void rotOrder (UT_XformOrder::xyzOrder rot)
 
bool rotOrder (const char *rot)
 
unsigned short operator() (UT_XformOrder::xform xf) const
 
UT_XformOrder::xform operator[] (unsigned short i) const
 
const char * mainOrderLabel () const
 
const char * rotOrderLabel () const
 

Static Public Member Functions

static void getRotOrderMapping (xyzOrder src, xyzOrder dst, int map[3])
 

Friends

std::ostream & operator<< (std::ostream &os, const UT_XformOrder &t)
 

Detailed Description

Transformation order of scales, rotates, and translates.

Definition at line 23 of file UT_XformOrder.h.

Member Enumeration Documentation

Enumerator
TRS 
TSR 
RTS 
RST 
STR 
SRT 

Definition at line 33 of file UT_XformOrder.h.

Enumerator
T 
S 
RX 
RY 
RZ 

Definition at line 28 of file UT_XformOrder.h.

Enumerator
XYZ 
XZY 
YXZ 
YZX 
ZXY 
ZYX 

Definition at line 34 of file UT_XformOrder.h.

Constructor & Destructor Documentation

UT_XformOrder::UT_XformOrder ( rstOrder  rst = UT_XformOrder::TSR,
xyzOrder  rot = UT_XformOrder::XYZ 
)
inline

Construct from one of the RST permutations and one of the rotation permutation

Definition at line 38 of file UT_XformOrder.h.

UT_XformOrder::UT_XformOrder ( xform  xf1,
xform  xf2,
xform  xf3 = UT_XformOrder::RX,
xform  xf4 = UT_XformOrder::RY,
xform  xf5 = UT_XformOrder::RZ 
)
inline

Full flexibility in constructing from specified component order. Avoid using this as you can specify orders here that lead to undefined behaviour for mainOrder() and rotOrder().

Definition at line 47 of file UT_XformOrder.h.

UT_XformOrder::UT_XformOrder ( const char *  rst,
const char *  rot = "xyz" 
)

Constructor that takes strings specifying the xform order. Any combination of lower and uppercase is acceptable ("TsR", "XZY", "rst"). We do NOT check the string lengths, but we do check for null pointers.

UT_XformOrder::UT_XformOrder ( const UT_XformOrder xf)
default

Member Function Documentation

int UT_XformOrder::count ( ) const
inline

Return the number of transforms we store, this bounds the indices used for operator() and operator[].

Definition at line 152 of file UT_XformOrder.h.

static void UT_XformOrder::getRotOrderMapping ( xyzOrder  src,
xyzOrder  dst,
int  map[3] 
)
static

Compute a mapping from the source to destination rotation order by filling in the given 'map' array.

void UT_XformOrder::invert ( )

Reverse the order.

bool UT_XformOrder::isScaleBeforeRotate ( ) const
inline

Returns true if order says scales are before rotates.

Definition at line 167 of file UT_XformOrder.h.

UT_XformOrder::rstOrder UT_XformOrder::mainOrder ( ) const
inline

Query or set the main xform order or the rotation order respectively. These methods assume the rotates are bundled together, and search for the position of the first rotate they find. The methods that take strings accept lower and uppercase combinations, check to see whether the argument is zero, but don't check its length.

Definition at line 81 of file UT_XformOrder.h.

void UT_XformOrder::mainOrder ( UT_XformOrder::rstOrder  rst)

Query or set the main xform order or the rotation order respectively. These methods assume the rotates are bundled together, and search for the position of the first rotate they find. The methods that take strings accept lower and uppercase combinations, check to see whether the argument is zero, but don't check its length.

bool UT_XformOrder::mainOrder ( const char *  rst)

Query or set the main xform order or the rotation order respectively. These methods assume the rotates are bundled together, and search for the position of the first rotate they find. The methods that take strings accept lower and uppercase combinations, check to see whether the argument is zero, but don't check its length.

const char* UT_XformOrder::mainOrderLabel ( ) const

User-facing labels for transform/rotate orders

bool UT_XformOrder::operator!= ( const UT_XformOrder order) const
inline

Definition at line 163 of file UT_XformOrder.h.

unsigned short UT_XformOrder::operator() ( UT_XformOrder::xform  xf) const
inline

Two operator: operator() returns the index of a given transform without having to check any bounds; operator[] returns the i'th transform and checks if it's between valid bounds.

Definition at line 137 of file UT_XformOrder.h.

UT_XformOrder& UT_XformOrder::operator= ( const UT_XformOrder xf)
default
bool UT_XformOrder::operator== ( const UT_XformOrder order) const
inline

Definition at line 154 of file UT_XformOrder.h.

UT_XformOrder::xform UT_XformOrder::operator[] ( unsigned short  i) const
inline

Two operator: operator() returns the index of a given transform without having to check any bounds; operator[] returns the i'th transform and checks if it's between valid bounds.

Definition at line 141 of file UT_XformOrder.h.

void UT_XformOrder::reorder ( UT_XformOrder::xform  xf1,
UT_XformOrder::xform  xf2,
UT_XformOrder::xform  xf3,
UT_XformOrder::xform  xf4,
UT_XformOrder::xform  xf5 
)

Shuffle the order of the xforms. If all you'll ever do is traverse the xform order to build a transformation matrix, you can even have more xforms of the same type in the argument list; then, however, the behaviour of mainOrder() and rotOrder() will be undefined.

void UT_XformOrder::reorder ( UT_XformOrder::rstOrder  rst,
UT_XformOrder::xyzOrder  rot 
)

Shuffle the order of the xforms. If all you'll ever do is traverse the xform order to build a transformation matrix, you can even have more xforms of the same type in the argument list; then, however, the behaviour of mainOrder() and rotOrder() will be undefined.

UT_XformOrder::xyzOrder UT_XformOrder::rotOrder ( ) const
inline

Query or set the main xform order or the rotation order respectively. These methods assume the rotates are bundled together, and search for the position of the first rotate they find. The methods that take strings accept lower and uppercase combinations, check to see whether the argument is zero, but don't check its length.

Definition at line 99 of file UT_XformOrder.h.

void UT_XformOrder::rotOrder ( UT_XformOrder::xyzOrder  rot)

Query or set the main xform order or the rotation order respectively. These methods assume the rotates are bundled together, and search for the position of the first rotate they find. The methods that take strings accept lower and uppercase combinations, check to see whether the argument is zero, but don't check its length.

bool UT_XformOrder::rotOrder ( const char *  rot)

Query or set the main xform order or the rotation order respectively. These methods assume the rotates are bundled together, and search for the position of the first rotate they find. The methods that take strings accept lower and uppercase combinations, check to see whether the argument is zero, but don't check its length.

const char* UT_XformOrder::rotOrderLabel ( ) const

User-facing labels for transform/rotate orders

int UT_XformOrder::save ( std::ostream &  os,
int  binary = 0 
) const

Save the xform order. We save the sequence of transforms in the order in which they appear in the permutation list.

void UT_XformOrder::swap ( UT_XformOrder::xform  xf1,
UT_XformOrder::xform  xf2 
)
inline

Swap two xform components.

Definition at line 119 of file UT_XformOrder.h.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const UT_XformOrder t 
)
friend

Definition at line 176 of file UT_XformOrder.h.


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