public class SbRotationd extends SbBasic
The rotation value is stored internally as a quaternion. Quaternion representation is more compact, faster to compute and more numerically stable than rotation matrices. Quaternion representation allows smooth rotation (spherical linear interpolation) and avoids the problem of "gimbal lock" associated with Euler angles. It is not necessary to deal directly with quaternions. Many convenience methods are provided to set and get rotations using matrix and axis/angle representations.
Rotations are most commonly specified using an axis and an angle in radians. A common mistake is to use the constructor or setValue method that takes four double values, when intending to set an axis and angle. The methods that take four double values directly specify the quaternion value, which is probably not the intended result. For example:
// Create a rotation of PI/2 radians around the Z axis: // Incorrect. // (Compiles, but actually sets the quaternion value directly!) SbRotationd rotation1 = new SbRotationd(0, 0, 1, 1.5707963); // This is the correct rotation. SbRotationd rotation2 = new SbRotationd(new SbVec3d(0, 0, 1), 1.5707963);
See also:
SbRotation
, SbVec2d
, SbVec2f
, SbVec2i32
, SbVec2s
, SbVec3d
, SbVec3f
, SbVec3i32
, SbVec3s
, SbVec4b
, SbVec4d
, SbVec4f
, SbVec4i32
, SbVec4s
, SbVec4ub
, SbVec4ui32
, SbVec4us
Modifier and Type | Class and Description |
---|---|
static class |
SbRotationd.AxisAngle |
Modifier and Type | Field and Description |
---|---|
double[] |
array |
Constructor and Description |
---|
SbRotationd()
Constructor for rotation.
|
SbRotationd(double[] components) |
SbRotationd(double q0,
double q1,
double q2,
double q3)
Constructor.
|
SbRotationd(SbMatrix3 m)
Constructor.
|
SbRotationd(SbMatrixd m)
Constructor.
|
SbRotationd(SbRotationd copyFrom) |
SbRotationd(SbVec3d axis,
double radians)
Constructor.
|
SbRotationd(SbVec3d rotateFrom,
SbVec3d rotateTo)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
SbRotationd.AxisAngle |
decompose()
Returns corresponding 3D rotation axis vector and angle in radians.
|
boolean |
equals(java.lang.Object obj) |
boolean |
equals(SbRotationd r,
double tolerance)
Equality comparison within given tolerance - the square of the length of the maximum distance between the two quaternion vectors.
|
SbMatrix |
getMatrix()
Returns corresponding 4x4 rotation matrix.
|
SbMatrix3 |
getMatrix3()
Returns corresponding 3x3 rotation matrix.
|
SbMatrixd |
getMatrixd()
Returns corresponding 4x4 rotation matrix.
|
double[] |
getValue() |
static SbRotationd |
identity()
Returns a null rotation.
|
SbRotationd |
inverse()
Returns the inverse of a rotation.
|
SbRotationd |
invert()
Changes a rotation to be its inverse.
|
void |
multiply(SbRotationd q)
Multiplies by another rotation; results in product of rotations.
|
SbVec3d |
multVec(SbVec3d src)
Multiplies the given vector by the matrix of this rotation.
|
void |
scaleAngle(double scaleFactor)
Keep the axis the same.
|
SbRotationd |
setValue(double[] components) |
SbRotationd |
setValue(double[] components,
int startIndex) |
SbRotationd |
setValue(double q0,
double q1,
double q2,
double q3)
Sets value of rotation from 4 individual components of a quaternion.
|
SbRotationd |
setValue(SbMatrix m)
Sets rotation from a single precision rotation matrix.
|
SbRotationd |
setValue(SbMatrix3 m)
Sets rotation from a 3x3 rotation matrix.
|
SbRotationd |
setValue(SbMatrixd m)
Sets value of rotation from a rotation matrix.
|
SbRotationd |
setValue(SbRotation rotate)
Sets rotation from a single precision rotation.
|
void |
setValue(SbRotationd copyFrom) |
SbRotationd |
setValue(SbVec3d axis,
double radians)
Sets value of vector from 3D rotation axis vector and angle in radians.
|
SbRotationd |
setValue(SbVec3d rotateFrom,
SbVec3d rotateTo)
Sets rotation to rotate one direction vector to another.
|
static SbRotationd |
slerp(SbRotationd rot0,
SbRotationd rot1,
double t)
Spherical linear interpolation: as t goes from 0 to 1, returned value goes from rot0 to rot1.
|
SbRotationd |
times(SbRotationd q2)
Multiplication of two rotations; results in product of rotations.
|
static SbRotationd[] |
toArray(long nativeArray,
long length) |
public SbRotationd(SbRotationd copyFrom)
public SbRotationd(double[] components)
public SbRotationd(double q0, double q1, double q2, double q3)
public SbRotationd()
public SbRotationd(SbMatrixd m)
public SbRotationd(SbMatrix3 m)
public SbRotationd(SbVec3d axis, double radians)
public SbRotationd setValue(double[] components)
public double[] getValue()
public SbRotationd setValue(double[] components, int startIndex)
public void setValue(SbRotationd copyFrom)
public void scaleAngle(double scaleFactor)
public SbVec3d multVec(SbVec3d src)
public SbRotationd times(SbRotationd q2)
public static SbRotationd identity()
public static SbRotationd[] toArray(long nativeArray, long length)
public SbRotationd setValue(double q0, double q1, double q2, double q3)
public static SbRotationd slerp(SbRotationd rot0, SbRotationd rot1, double t)
public SbMatrixd getMatrixd()
public SbRotationd setValue(SbVec3d axis, double radians)
public SbRotationd.AxisAngle decompose()
public SbRotationd setValue(SbVec3d rotateFrom, SbVec3d rotateTo)
public SbMatrix getMatrix()
public SbRotationd invert()
public SbRotationd inverse()
public SbRotationd setValue(SbMatrixd m)
public SbMatrix3 getMatrix3()
public SbRotationd setValue(SbRotation rotate)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean equals(SbRotationd r, double tolerance)
public SbRotationd setValue(SbMatrix3 m)
public SbRotationd setValue(SbMatrix m)
public void multiply(SbRotationd q)
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com