Xfo (struct)¶
The Xfo type represents a 3D transform. It uses a Vec3 for translation as scaling as well as a Quat for its rotation. The Xfo can also be expressed as a Mat44, and provides conversion methods for that type.
/*
** Example: Xfo
*/
// create a transform
Xfo xfo;
// change the transform
xfo.tr.x = 3.0;
xfo.ori.setFromAxisAndAngle(Vec3(1.0, 0.0, 0.0), 0.65);
xfo.sc *= Vec3(1, 2, 3);
// project a vector
Vec3 pos = xfo.transformVector(Vec3(0, 10, 0));
Methods¶
Xfo ( in Mat44 mat ) | |
Xfo ( in Quat ori ) | |
Xfo ( in Quat ori, in Vec3 tr, in Vec3 sc ) | |
Xfo ( in Scalar scX, in Scalar scY, in Scalar scZ, in Scalar eulerX, in Scalar eulerY, in Scalar eulerZ, in Scalar trX, in Scalar trY, in Scalar trZ ) | |
Xfo ( in Vec3 tr ) | |
Xfo ( in Vec3 tr, in Quat ori ) | |
Xfo ( in Vec3 tr, in Quat ori, in Vec3 sc ) | |
Xfo ( in Xfo other ) | |
Xfo () | |
XfoFromScalars ! ( in Scalar scX, in Scalar scY, in Scalar scZ, in Scalar degreeX, in Scalar degreeY, in Scalar degreeZ, in Scalar trX, in Scalar trY, in Scalar trZ ) | |
XfoFromVec3s ! ( in Vec3 sc, in Vec3 rotInDeg, in Vec3 tr ) | |
Xfo | clone ? () |
Scalar | distanceTo ? ( in Xfo other ) |
get ? ( io Float32 v<> ) | |
get ? ( io Float32 v<>, in UInt32 o ) | |
get ? ( io Float32 v[] ) | |
get ? ( io Float32 v[], in UInt32 o ) | |
get ? ( io Float64 v<> ) | |
get ? ( io Float64 v<>, in UInt32 o ) | |
get ? ( io Float64 v[] ) | |
get ? ( io Float64 v[], in UInt32 o ) | |
UInt32 | hash ? () |
Xfo | inverse ? () |
Vec3 | inverseTransformVector ? ( in Vec3 vec ) |
Xfo | linearInterpolate ? ( in Xfo other, in Scalar t ) |
Xfo | multiply ? ( in Xfo global ) |
set ! ( in Float32 v<> ) | |
set ! ( in Float32 v<>, in UInt32 o ) | |
set ! ( in Float64 v<> ) | |
set ! ( in Float64 v<>, in UInt32 o ) | |
set ! ( in Mat33 mat ) | |
set ! ( in Quat ori ) | |
set ! ( in Quat ori, in Vec3 tr, in Vec3 sc ) | |
set ! ( in Vec3 tr ) | |
set ! ( in Vec3 tr, in Quat ori ) | |
set ! ( in Vec3 tr, in Quat ori, in Vec3 sc ) | |
setFromMat44 ! ( in Mat44 m ) | |
setIdentity ! () | |
Xfo | sphericalLinearInterpolate ? ( in Xfo other, in Scalar t ) |
Vec3 | subtractTranslation ? ( in Xfo other ) |
Mat44 | toMat44 ? () |
Ray | transformRay ? ( in Ray ray ) |
Vec3 | transformVector ? ( in Vec3 v ) |
Methods in detail¶
Constructor from Mat44
Constructor from just the rotation
Xfo ( in Quat ori, in Vec3 tr, in Vec3 sc )
Constructor from the orientation, translation and scaling
Xfo ( in Scalar scX, in Scalar scY, in Scalar scZ, in Scalar eulerX, in Scalar eulerY, in Scalar eulerZ, in Scalar trX, in Scalar trY, in Scalar trZ )
Constructor from single channels
Constructor from just the translation
Xfo ( in Vec3 tr, in Quat ori )
Constructor from the translation and rotation
Xfo ( in Vec3 tr, in Quat ori, in Vec3 sc )
Constructor from the translation, rotation and scaling
copy constructor
Xfo ()
Default constructor set the transform to the identity
Xfo.XfoFromScalars! ( in Scalar scX, in Scalar scY, in Scalar scZ, in Scalar degreeX, in Scalar degreeY, in Scalar degreeZ, in Scalar trX, in Scalar trY, in Scalar trZ )
Setter from single channels, the rotation being in degrees
Xfo.XfoFromVec3s! ( in Vec3 sc, in Vec3 rotInDeg, in Vec3 tr )
Setter from scaling, rotation (in degrees) and translation.
clone method
Scalar Xfo.distanceTo? ( in Xfo other )
returns the translation distance between two xfos
Getter as external float32 array
Xfo.get? ( io Float32 v<>, in UInt32 o )
Getter as external float32 array and an offset
Getter as float32 array
Xfo.get? ( io Float32 v[], in UInt32 o )
Getter as float32 array and an offset
Getter as external float64 array
Xfo.get? ( io Float64 v<>, in UInt32 o )
Getter as external float64 array and an offset
Getter as float64 array
Xfo.get? ( io Float64 v[], in UInt32 o )
Getter as float64 array and an offset
Hash for this value
Returns the inverse transform of this one
Vec3 Xfo.inverseTransformVector? ( in Vec3 vec )
Transforms a vector with this xfo inversely
注釈
we have ‘inverseTransformVector’ because Xfos with non-uniform scaling cannot be inverted as Xfos
Xfo Xfo.linearInterpolate? ( in Xfo other, in Scalar t )
Linearly interpolates this Xfo with another one based on a scalar blend value (0.0 to 1.0)
Xfo Xfo.multiply? ( in Xfo global )
Overload method for the multiply operator
Setter from (standard/external) float32 array
Xfo.set! ( in Float32 v<>, in UInt32 o )
Setter from (standard/external) float32 array and an offset
Setter from (standard/external) float64 array
Xfo.set! ( in Float64 v<>, in UInt32 o )
Setter from (standard/external) float64 array and an offset
Setter from Mat33 (only setting rotation)
Setter from just the rotation
Xfo.set! ( in Quat ori, in Vec3 tr, in Vec3 sc )
Setter from the orientation, translation and scaling
Setter from just the translation
Xfo.set! ( in Vec3 tr, in Quat ori )
Setter from the translation and rotation
Xfo.set! ( in Vec3 tr, in Quat ori, in Vec3 sc )
Setter from the translation, rotation and scaling
Xfo.setFromMat44! ( in Mat44 m )
Sets this transform from a given Mat44
Xfo.setIdentity! ()
Sets this transform to the identity
Xfo Xfo.sphericalLinearInterpolate? ( in Xfo other, in Scalar t )
interpolates two Xfos spherically (slerp) given a scalar blend value (0.0 to 1.0).
Vec3 Xfo.subtractTranslation? ( in Xfo other )
returns the translation subtraction between two xfos
Returns this xfo as a Mat44
Ray Xfo.transformRay? ( in Ray ray )
Transforms a vector with this transform
Vec3 Xfo.transformVector? ( in Vec3 v )
Transforms a vector with this transform