24 #ifndef PXR_BASE_GF_ROTATION_H
25 #define PXR_BASE_GF_ROTATION_H
36 #include "pxr/base/gf/api.h"
38 #include <boost/functional/hash.hpp>
42 PXR_NAMESPACE_OPEN_SCOPE
91 if (!
GfIsClose(_axis * _axis, 1.0, 1e-10))
116 _axis.
Set(1.0, 0.0, 0.0);
134 return GfQuaternion(quat.GetReal(), quat.GetImaginary());
180 static void DecomposeRotation(
const GfMatrix4d &rot,
188 double *thetaSw = NULL,
190 const double *swShift=NULL);
211 boost::hash_combine(h, r._axis);
212 boost::hash_combine(h, r._angle);
221 return (_axis == r._axis &&
230 return ! (*
this == r);
260 return rTmp *= scale;
273 return rTmp /= scale;
288 PXR_NAMESPACE_CLOSE_SCOPE
290 #endif // PXR_BASE_GF_ROTATION_H
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.
double GetAngle() const
Returns the rotation angle in degrees.
bool operator==(const GfRotation &r) const
Component-wise rotation equality test.
bool operator!=(const GfRotation &r) const
Component-wise rotation inequality test.
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.
const GfVec3d & GetAxis() const
Returns the axis of rotation.
Basic type: complex number with scalar real part and vector imaginary part.
friend GfRotation operator*(const GfRotation &r1, const GfRotation &r2)
Returns composite rotation of rotations r1 and r2.
double GetReal() const
Returns the real part of the quaternion.
GfVec3d & Set(double s0, double s1, double s2)
Set all elements with passed arguments.
GF_API GfVec3f TransformDir(const GfVec3f &vec) const
Transforms row vector vec by the rotation, returning the result.
Stores a 4x4 matrix of double elements.
GfRotation(const GfQuaternion &quaternion)
This constructor initializes the rotation from a quaternion.
GF_API GfVec3d Decompose(const GfVec3d &axis0, const GfVec3d &axis1, const GfVec3d &axis2) const
Decompose rotation about 3 orthogonal axes.
GF_API GfQuatd GetQuat() const
Returns the rotation expressed as a quaternion.
GfRotation & SetAxisAngle(const GfVec3d &axis, double angle)
Sets the rotation to be angle degrees about axis.
GF_API GfRotation & operator*=(const GfRotation &r)
Post-multiplies rotation r into this rotation.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
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.
GfQuaternion GetQuaternion() const
Returns the rotation expressed as a quaternion.
const GfVec3d & GetImaginary() const
Returns the imaginary part of the quaternion.
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...
GfRotation(const GfQuatd &quat)
This constructor initializes the rotation from a quaternion.
GfRotation & SetIdentity()
Sets the rotation to an identity rotation.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients...
GfRotation GetInverse() const
Returns the inverse of this rotation.
GfRotation()
The default constructor leaves the rotation undefined.
Basic type: 3-space rotation specification.
GfRotation(const GfVec3d &axis, double angle)
This constructor initializes the rotation to be angle degrees about axis.