Transformations (C++)¶
- 
group FnXFormUtil
- 
class FnXFormUtil¶
- #include <FnXFormUtil.h>Provides a number of matrix transform utilities. Matrix ordering matches the IMath convention: FnAttribute::DoubleAttribute::array_type m = attr.getNearestSample(0.f); Imath::M44d(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15]); or, Imath::M44d( (double(*)[4]) m.data()); Public Static Functions - 
static std::pair<FnAttribute::DoubleAttribute, bool> CalcTransformMatrixAtTime(const FnAttribute::GroupAttribute &groupAttr, float time)¶
- Return
- (4x4 matrix attr, isAbsolute)
- Parameters
- groupAttr-- the FnAttribute::GroupAttribute to calculate the transform from. 
- time-- the sample time at which to calculate the transform. 
 
 
 - 
static std::pair<FnAttribute::DoubleAttribute, bool> CalcTransformMatrixAtTimes(const FnAttribute::GroupAttribute &groupAttr, const float *time, int numSamples)¶
- Note
- This will do xform interpolation as needed
- Return
- return (4x4 matrix attr, isAbsolute)
- Parameters
- groupAttr-- FnAttribute::GroupAttribute containing the transform 
- time-- sample time to calculate the transform at. 
- numSamples-- number of time samples in time argument. 
 
 
 - 
static std::pair<FnAttribute::DoubleAttribute, bool> CalcTransformMatrixAtExistingTimes(const FnAttribute::GroupAttribute &groupAttr)¶
- Note
- This will do xform interpolation as needed
- Return
- return (4x4 matrix attr, isAbsolute)
- Parameters
- groupAttr-- FnAttribute::GroupAttribute containing the transform 
 
 
 - 
static FnAttribute::DoubleAttribute CreateBoundsAttr(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)¶
- Creates a bounds attribute with the following properties: - Tuple Size: 2
- Length: 6,
- Values: [xMin, xMax, yMin, yMax, zMin, zMax]
 - Return
- an FnAttribute::DoubleAttribute instance.
- Parameters
- xMin-- x min 
- xMax-- x max 
- yMin-- y min 
- yMax-- y max 
- zMin-- z max 
- zMax-- z max 
 
 
 - 
static FnAttribute::DoubleAttribute MergeBounds(const FnAttribute::DoubleAttribute &boundAttr1, const FnAttribute::DoubleAttribute &boundAttr2)¶
- Merge the two bounds attributes. If the boundsAttrs are multi-sampled, the output bounds will be up-sampled to the union of incoming sample times. Bounds data at sample-times not provided (but needed) will be synthesized using fillInterpSample() - Return
- an instance of FnAttribute::DoubleAttribute containing the merged attributes.
- Parameters
- boundAttr1-- first bounds attribute 
- boundAttr2-- second bounds attribute 
 
 
 - 
static FnAttribute::DoubleAttribute CalcTransformedBoundsAtExistingTimes(const FnAttribute::Attribute &xform, const FnAttribute::DoubleAttribute &boundAttr)¶
- Calculates a new bounds attribute after baking in the specified coordinate system. - The input transform can either be specified as a 4 x 4 FnAttribute::DoubleAttribute (matrix) or as an unbaked FnAttribute::GroupAttribute - xformhierarchy. All other types will result in failure an invalid FnAttribute instance being returned.- The computed bounds attribute will contain time samples at the union of existing samples in the incoming - xformand- boundattributes.- If a user requires a non-multisampled bound attribute, this call should be followed up with a call to CollapseBoundTimeSamples() - Return
- the new transformed bound attribute.
- Parameters
- xform-- the coordinate system 
- boundAttr-- the bound attribute to transform 
 
 
 - 
static FnAttribute::DoubleAttribute CollapseBoundsTimeSamples(const FnAttribute::DoubleAttribute &boundAttr)¶
- Creates a single sampled attribute with the merged union of the mutlisampled input attribute. - Return
- Single sample merged union of the input bound attribute
- Parameters
- boundAttr-- Multisampled bound attribute 
 
 
 - 
static void InitXForm(FnAttribute::GroupBuilder &gb)¶
- This group of function accepting FnAttribute::GroupBuilder references are used to simplify the construction of - xformattributes.- For the specified GroupBuilder, set - group- inheritto- false(as all xforms should be) and then do a shallow update with the specified attribute, if provided.- Note
- All children must be either instances of FnAttribute::DoubleAttributes or FnAttribute::GroupAttribute.
 - Note that if one’s command sequence utilizes only: - Init(gb, ...) PushXXX(...) PushXXX(...) PushXXX(...) etc... - It’s OK to construct the group builder with the GroupBuilder::BuilderModeStrict argument. - Parameters
- gb-- An instance of FnAttribute::GroupBuilder 
 
 
 - 
static void InitXForm(FnAttribute::GroupBuilder &gb, const FnAttribute::Attribute &xform)¶
 - 
static void PushRotateAttr(FnAttribute::GroupBuilder &gb, double angle, double x, double y, double z)¶
 - 
static FnAttribute::Attribute PushRotateAttr(const FnAttribute::Attribute &xform, double angle, double x, double y, double z)¶
 - 
static void PushTranslateAttr(FnAttribute::GroupBuilder &gb, double x, double y, double z)¶
 - 
static FnAttribute::Attribute PushTranslateAttr(const FnAttribute::Attribute &xform, double x, double y, double z)¶
 - 
static void PushScaleAttr(FnAttribute::GroupBuilder &gb, double x, double y, double z)¶
 - 
static FnAttribute::Attribute PushScaleAttr(const FnAttribute::Attribute &xform, double x, double y, double z)¶
 - 
static void PushMatrixAttr(FnAttribute::GroupBuilder &gb, const double *mtx16)¶
 - 
static FnAttribute::Attribute PushMatrixAttr(const FnAttribute::Attribute &xform, const double *mtx16)¶
 - 
static void PushOriginAttr(FnAttribute::GroupBuilder &gb)¶
 - 
static FnAttribute::Attribute PushOriginAttr(const FnAttribute::Attribute &xform)¶
 
- 
static std::pair<FnAttribute::DoubleAttribute, bool> 
 
- 
class