24 #ifndef PXR_BASE_GF_ROTATION_H 25 #define PXR_BASE_GF_ROTATION_H 36 #include "pxr/base/gf/api.h" 41 PXR_NAMESPACE_OPEN_SCOPE
90 if (!
GfIsClose(_axis * _axis, 1.0, 1e-10))
115 _axis.
Set(1.0, 0.0, 0.0);
133 return GfQuaternion(quat.GetReal(), quat.GetImaginary());
179 static void DecomposeRotation(
const GfMatrix4d &rot,
187 double *thetaSw =
nullptr,
189 const double *swShift=
nullptr);
210 double targetTw,
double targetFB,
double targetLR,
double targetSw,
211 double *thetaTw,
double *thetaFB,
double *thetaLR,
double *thetaSw);
231 return (_axis == r._axis &&
240 return ! (*
this == r);
270 return rTmp *= scale;
283 return rTmp /= scale;
298 PXR_NAMESPACE_CLOSE_SCOPE
300 #endif // PXR_BASE_GF_ROTATION_H GF_API GfRotation & operator *=(const GfRotation &r)
Post-multiplies rotation r into this rotation.
GfRotation & operator/=(double scale)
Scales rotation angle by dividing by scale.
bool GfIsClose(double a, double b, double epsilon)
Returns true if a and b are with epsilon of each other.
friend GfRotation operator *(double scale, const GfRotation &r)
Returns a rotation equivalent to r with its angle multiplied by scale.
friend size_t hash_value(const GfRotation &r)
Hash.
Basic type for a vector of 3 float components.
GfRotation & SetQuaternion(const GfQuaternion &quat)
Sets the rotation from a quaternion.
GF_API GfRotation & SetRotateInto(const GfVec3d &rotateFrom, const GfVec3d &rotateTo)
Sets the rotation to one that brings the rotateFrom vector to align with rotateTo.
Basic type: complex number with scalar real part and vector imaginary part.
double GetAngle() const
Returns the rotation angle in degrees.
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
GfVec3d & Set(double s0, double s1, double s2)
Set all elements with passed arguments.
bool operator==(const GfRotation &r) const
Component-wise rotation equality test.
Stores a 4x4 matrix of double elements.
bool operator !=(const GfRotation &r) const
Component-wise rotation inequality test.
GfRotation(const GfQuaternion &quaternion)
This constructor initializes the rotation from a quaternion.
double GetReal() const
Returns the real part of the quaternion.
GF_API GfVec3d Decompose(const GfVec3d &axis0, const GfVec3d &axis1, const GfVec3d &axis2) const
Decompose rotation about 3 orthogonal axes.
GfRotation & SetAxisAngle(const GfVec3d &axis, double angle)
Sets the rotation to be angle degrees about axis.
GF_API GfQuatd GetQuat() const
Returns the rotation expressed as a quaternion.
static GF_API void MatchClosestEulerRotation(double targetTw, double targetFB, double targetLR, double targetSw, double *thetaTw, double *thetaFB, double *thetaLR, double *thetaSw)
Replace the hint angles with the closest rotation of the given rotation to the hint.
GF_API GfRotation & SetQuat(const GfQuatd &quat)
Sets the rotation from a quaternion.
friend GfRotation operator/(const GfRotation &r, double scale)
Returns a rotation equivalent to r with its angle divided by scale.
Basic type for a vector of 3 double components.
GF_API GfRotation(const GfVec3d &rotateFrom, const GfVec3d &rotateTo)
This constructor initializes the rotation to one that brings the rotateFrom vector to align with rota...
GfQuaternion GetQuaternion() const
Returns the rotation expressed as a quaternion.
GfRotation(const GfQuatd &quat)
This constructor initializes the rotation from a quaternion.
GfRotation & SetIdentity()
Sets the rotation to an identity rotation.
GF_API GfVec3f TransformDir(const GfVec3f &vec) const
Transforms row vector vec by the rotation, returning the result.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
GfRotation()
The default constructor leaves the rotation undefined.
const GfVec3d & GetImaginary() const
Returns the imaginary part of the quaternion.
Basic type: 3-space rotation specification.
friend GfRotation operator *(const GfRotation &r1, const GfRotation &r2)
Returns composite rotation of rotations r1 and r2.
GfRotation & operator *=(double scale)
Scales rotation angle by multiplying by scale.
GF_API std::ostream & operator<<(std::ostream &, const GfRotation &)
Output a GfRotation using the format [(x y z) a].
const GfVec3d & GetAxis() const
Returns the axis of rotation.
friend GfRotation operator *(const GfRotation &r, double scale)
Returns a rotation equivalent to r with its angle multiplied by scale.
GfRotation GetInverse() const
Returns the inverse of this rotation.
GfRotation(const GfVec3d &axis, double angle)
This constructor initializes the rotation to be angle degrees about axis.