7#ifndef PXR_BASE_GF_ROTATION_H
8#define PXR_BASE_GF_ROTATION_H
19#include "pxr/base/gf/api.h"
24PXR_NAMESPACE_OPEN_SCOPE
73 if (!
GfIsClose(_axis * _axis, 1.0, 1e-10))
98 _axis.
Set(1.0, 0.0, 0.0);
116 return GfQuaternion(quat.GetReal(), quat.GetImaginary());
162 static void DecomposeRotation(
const GfMatrix4d &rot,
170 double *thetaSw =
nullptr,
172 const double *swShift=
nullptr);
193 double targetTw,
double targetFB,
double targetLR,
double targetSw,
194 double *thetaTw,
double *thetaFB,
double *thetaLR,
double *thetaSw);
210 return (_axis == r._axis &&
219 return ! (*
this == r);
249 return rTmp *= scale;
262 return rTmp /= scale;
277PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Basic type: complex number with scalar real part and vector imaginary part.
const GfVec3d & GetImaginary() const
Returns the imaginary part of the quaternion.
double GetReal() const
Returns the real part of the quaternion.
Basic type: 3-space rotation specification.
GfRotation & operator/=(double scale)
Scales rotation angle by dividing by scale.
GfRotation(const GfQuaternion &quaternion)
This constructor initializes 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.
GF_API GfVec3d Decompose(const GfVec3d &axis0, const GfVec3d &axis1, const GfVec3d &axis2) const
Decompose rotation about 3 orthogonal axes.
const GfVec3d & GetAxis() const
Returns the axis of rotation.
GfRotation & SetQuaternion(const GfQuaternion &quat)
Sets the rotation from a quaternion.
GfRotation()
The default constructor leaves the rotation undefined.
GF_API GfVec3d TransformDir(const GfVec3d &vec) const
Transforms row vector vec by the rotation, returning the result.
GF_API GfRotation & SetRotateInto(const GfVec3d &rotateFrom, const GfVec3d &rotateTo)
Sets the rotation to one that brings the rotateFrom vector to align with rotateTo.
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...
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.
GfRotation(const GfVec3d &axis, double angle)
This constructor initializes the rotation to be angle degrees about axis.
GF_API GfRotation & operator*=(const GfRotation &r)
Post-multiplies rotation r into this rotation.
GfRotation & SetIdentity()
Sets the rotation to an identity rotation.
GF_API GfQuatd GetQuat() const
Returns the rotation expressed as a quaternion.
double GetAngle() const
Returns the rotation angle in degrees.
GfRotation(const GfQuatd &quat)
This constructor initializes the rotation from a quaternion.
friend GfRotation operator*(const GfRotation &r1, const GfRotation &r2)
Returns composite rotation of rotations r1 and r2.
bool operator!=(const GfRotation &r) const
Component-wise rotation inequality test.
friend size_t hash_value(const GfRotation &r)
Hash.
GfQuaternion GetQuaternion() const
Returns the rotation expressed as a quaternion.
GF_API GfRotation & SetQuat(const GfQuatd &quat)
Sets the rotation from a quaternion.
bool operator==(const GfRotation &r) const
Component-wise rotation equality test.
GfRotation GetInverse() const
Returns the inverse of this rotation.
GfRotation & SetAxisAngle(const GfVec3d &axis, double angle)
Sets the rotation to be angle degrees about axis.
Basic type for a vector of 3 double components.
GfVec3d & Set(double s0, double s1, double s2)
Set all elements with passed arguments.
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
bool GfIsClose(GfColor const &c1, GfColor const &c2, double tolerance)
Tests for equality of the RGB tuple in a color with a given tolerance, returning true if the length o...
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].