Debian Codegraph @

doc/man/man3/ivm/basics/SbRotation.ivm

raw
1 NAME SbRotation SbRot "" { class for representing a rotation }
2 INCLUDE SbLinear.h
3 DESC {
4 Object that stores a rotation. There are several ways to specify a
5 rotation: quaternion (4 floats), 4x4 rotation matrix, or axis and angle.
6 All angles are in radians and all rotations are right-handed.
7 \-
8 This object does not have \mCreate\. or \mDelete\.
9 functions because it is a simple datatype. C programmers should declare
10 and/or malloc rotations as standard C structs.
11 Access the components of the vector as though it is a simple
12 structure or use the access and operation functions described in
13 this reference page:
14 \b\k
15 /* This is defined in Inventor_c/SbLinear.h: */
16 struct SbRotation \{
17 float quat[4];
18 \};
19 typedef SbRotation SbRot
20
21
22 /* This is what your code should look like: */
23 SbRot r1, r2;
24
25 /* The next two lines produce equivalent rotations. */
26 r1.quat[0] = 1.0; r1.quat[1] = r1.quat[2] = 0.0; r1.quat[3] = 1.0;
27 SbRotSetQ_U_A_T( v2, 1.0, 0.0, 0.0, 1.0 );
28 \.\.
29 \.
30 }
31 BEGIN C++
32 METHOD "" SbRotation() {}
33 METHOD "" SbRotation(const SbVec3f &axis, float radians) {}
34 METHOD "" SbRotation(const float v[4]) {}
35 METHOD "" SbRotation(float q0, float q1, float q2, float q3) {}
36 METHOD "" SbRotation(const SbMatrix &m) {}
37 METHOD "" SbRotation(const SbVec3f &rotateFrom, const SbVec3f &rotateTo) {
38 Constructors for rotation. The axis/radians constructor creates a rotation of
39 angle radians about the given axis. The constructors that take four floats
40 create a quaternion from those floats (careful, this differs from the four
41 numbers in an axis/radian definition).
42 Matrix constructor requires a valid rotation matrix.
43 The rotateFrom/To constructor defines rotation that rotates from one vector
44 into another.
45 The \arotateFrom\. and \arotateTo\. vectors are normalized by the constructor
46 before calculating the rotation.}
47 METHOD "" const float * getValue() const {
48 Returns pointer to array of 4 components defining quaternion.
49 }
50 METHOD "" void getValue(float &q0, float &q1,
51 float &q2, float &q3) const {
52 Returns 4 individual components of rotation quaternion.
53 }
54 METHOD "" SbRotation & setValue(float q0, float q1, float q2, float q3) {
55 Sets value of rotation from 4 individual components of a quaternion.
56 }
57 END
58 BEGIN C
59 MACRO SbRotGetQuat(float *dest, SbRotation *src) {}
60 MACRO SbRotGetQ_U_A_T(float q0, float q1, float q2, float q3,
61 SbRotation *src) {}
62 MACRO SbRotSetQuat(SbRotation *dest, float *src) {}
63 MACRO SbRotSetQ_U_A_T(SbRotation *dest, float q0, float q1,
64 float q2, float q3) {
65 Sets and gets rotations in the form of quaternions. The quaternion may
66 be passed either as an array of length 4 or as 4 separate components.
67 }
68 END
69 METHOD getAxisAngle void getValue(SbVec3f &axis, float &radians) const {
70 Returns corresponding 3D rotation axis vector and angle in radians.
71 }
72 METHOD getMx void getValue(SbMatrix &matrix) const {
73 Returns corresponding 4x4 rotation matrix.
74 }
75 METHOD "" SbRotation & invert() {
76 Changes a rotation to be its inverse.
77 }
78 METHOD "" SbRotation inverse() const {
79 Returns the inverse of a rotation.
80 }
81 BEGIN C++
82 METHOD "" SbRotation & setValue(const float q[4]) {
83 Sets value of rotation from array of 4 components of a quaternion.
84 }
85 END
86 METHOD setMx SbRotation & setValue(const SbMatrix &m) {
87 Sets value of rotation from a rotation matrix.
88 }
89 METHOD setAxisAngle SbRotation & setValue(const SbVec3f &axis, float radians) {
90 Sets value of vector from 3D rotation axis vector and angle in radians.
91 }
92 METHOD setFromTo SbRotation & setValue(const SbVec3f &rotateFrom,
93 const SbVec3f &rotateTo) {
94 Sets rotation to rotate one direction vector to another. The \arotateFrom\.
95 and \arotateTo\. arguments are normalized before the rotation is calculated.
96 }
97 BEGIN C++
98 METHOD "" SbRotation & operator *=(const SbRotation &q) {
99 Multiplies by another rotation; results in product of rotations.
100 }
101 END
102 METHOD "" int operator ==(const SbRotation &q1, const SbRotation &q2) {}
103 METHOD "" int operator !=(const SbRotation &q1, const SbRotation &q2) {
104 Equality comparison operators.
105 }
106 METHOD "" SbBool equals(const SbRotation &r, float tolerance) const {
107 Equality comparison within given tolerance \(em the square of the
108 length of the maximum distance between the two quaternion vectors.
109 }
110 METHOD "" SbRotation operator *(const SbRotation &q1, const SbRotation &q2) {
111 Multiplication of two rotations; results in product of rotations.
112 }
113 METHOD "" void multVec(const SbVec3f &src, SbVec3f &dst) const {
114 Multiplies the given vector by the matrix of this rotation.
115 }
116 METHOD "" void scaleAngle( float scaleFactor ) {
117 Keep the axis the same. Multiply the angle of rotation by
118 the amount \ascaleFactor\..
119 }
120 METHOD "" static SbRotation slerp(const SbRotation &rot0,
121 const SbRotation &rot1, float t) {
122 Spherical linear interpolation: as \at\. goes from 0 to 1, returned
123 value goes from \arot0\. to \arot1\..
124 }
125 METHOD ident static SbRotation identity() {
126 Returns a null rotation.
127 }
128 ALSO { SbVec3f, SbMatrix }
129
130 MISC NOTES {
131 Rotations are stored internally as quaternions.
132 }