1SbRotation(3IV)()                                            SbRotation(3IV)()
2
3
4

NAME

6       SbRotation — class for representing a rotation
7

INHERITS FROM

9       SbRotation
10

SYNOPSIS

12       #include <Inventor/SbLinear.h>
13
14          Methods from class SbRotation:
15
16                         SbRotation()
17                         SbRotation(const SbVec3f &axis, float radians)
18                         SbRotation(const float v[4])
19                         SbRotation(float q0, float q1, float q2, float q3)
20                         SbRotation(const SbMatrix &m)
21                         SbRotation(const  SbVec3f  &rotateFrom, const SbVec3f
22                              &rotateTo)
23     const float *       getValue() const
24     void                getValue(float &q0, float &q1, float &q2, float  &q3)
25                              const
26     SbRotation &        setValue(float q0, float q1, float q2, float q3)
27     void                getValue(SbVec3f &axis, float &radians) const
28     void                getValue(SbMatrix &matrix) const
29     SbRotation &        invert()
30     SbRotation          inverse() const
31     SbRotation &        setValue(const float q[4])
32     SbRotation &        setValue(const SbMatrix &m)
33     SbRotation &        setValue(const SbVec3f &axis, float radians)
34     SbRotation  &        setValue(const  SbVec3f  &rotateFrom,  const SbVec3f
35                              &rotateTo)
36     SbRotation &        operator *=(const SbRotation &q)
37     int                 operator ==(const SbRotation  &q1,  const  SbRotation
38                              &q2)
39     int                 operator  !=(const  SbRotation  &q1, const SbRotation
40                              &q2)
41     SbBool              equals(const SbRotation &r, float tolerance) const
42     SbRotation          operator *(const  SbRotation  &q1,  const  SbRotation
43                              &q2)
44     void                multVec(const SbVec3f &src, SbVec3f &dst) const
45     void                scaleAngle(float scaleFactor )
46     static SbRotation   slerp(const SbRotation &rot0, const SbRotation &rot1,
47                              float t)
48     static SbRotation   identity()
49
50

DESCRIPTION

52       Object that stores a rotation. There are  several  ways  to  specify  a
53       rotation:  quaternion  (4  floats),  4x4  rotation  matrix, or axis and
54       angle. All angles are in radians and all rotations are right-handed.
55

METHODS

57                         SbRotation()
58                         SbRotation(const SbVec3f &axis, float radians)
59                         SbRotation(const float v[4])
60                         SbRotation(float q0, float q1, float q2, float q3)
61                         SbRotation(const SbMatrix &m)
62                         SbRotation(const SbVec3f &rotateFrom,  const  SbVec3f
63                              &rotateTo)
64          Constructors  for  rotation.  The axis/radians constructor creates a
65          rotation of angle radians about the  given  axis.  The  constructors
66          that  take  four floats create a quaternion from those floats (care‐
67          ful, this differs from the four numbers in  an  axis/radian  defini‐
68          tion).  Matrix  constructor  requires  a  valid rotation matrix. The
69          rotateFrom/To constructor defines rotation  that  rotates  from  one
70          vector into another. The rotateFrom and rotateTo vectors are normal‐
71          ized by the constructor before calculating the rotation.
72
73     const float *       getValue() const
74          Returns pointer to array of 4 components defining quaternion.
75
76     void                getValue(float &q0, float &q1, float &q2, float  &q3)
77                              const
78          Returns 4 individual components of rotation quaternion.
79
80     SbRotation &        setValue(float q0, float q1, float q2, float q3)
81          Sets value of rotation from 4 individual components of a quaternion.
82
83     void                getValue(SbVec3f &axis, float &radians) const
84          Returns corresponding 3D rotation axis vector and angle in radians.
85
86     void                getValue(SbMatrix &matrix) const
87          Returns corresponding 4x4 rotation matrix.
88
89     SbRotation &        invert()
90          Changes a rotation to be its inverse.
91
92     SbRotation          inverse() const
93          Returns the inverse of a rotation.
94
95     SbRotation &        setValue(const float q[4])
96          Sets value of rotation from array of 4 components of a quaternion.
97
98     SbRotation &        setValue(const SbMatrix &m)
99          Sets value of rotation from a rotation matrix.
100
101     SbRotation &        setValue(const SbVec3f &axis, float radians)
102          Sets value of vector from 3D rotation axis vector and angle in radi‐
103          ans.
104
105     SbRotation &        setValue(const  SbVec3f  &rotateFrom,  const  SbVec3f
106                              &rotateTo)
107          Sets rotation to rotate one direction vector to another. The rotate‐
108          From and rotateTo arguments are normalized before  the  rotation  is
109          calculated.
110
111     SbRotation &        operator *=(const SbRotation &q)
112          Multiplies by another rotation; results in product of rotations.
113
114     int                 operator  ==(const  SbRotation  &q1, const SbRotation
115                              &q2)
116     int                 operator !=(const SbRotation  &q1,  const  SbRotation
117                              &q2)
118          Equality comparison operators.
119
120     SbBool              equals(const SbRotation &r, float tolerance) const
121          Equality  comparison  within  given  tolerance  —  the square of the
122          length of the maximum distance between the two quaternion vectors.
123
124     SbRotation          operator *(const  SbRotation  &q1,  const  SbRotation
125                              &q2)
126          Multiplication of two rotations; results in product of rotations.
127
128     void                multVec(const SbVec3f &src, SbVec3f &dst) const
129          Multiplies the given vector by the matrix of this rotation.
130
131     void                scaleAngle(float scaleFactor )
132          Keep the axis the same. Multiply the angle of rotation by the amount
133          scaleFactor.
134
135     static SbRotation   slerp(const SbRotation &rot0, const SbRotation &rot1,
136                              float t)
137          Spherical  linear  interpolation:  as  t  goes from 0 to 1, returned
138          value goes from rot0 to rot1.
139
140     static SbRotation   identity()
141          Returns a null rotation.
142
143

NOTES

145       Rotations are stored internally as quaternions.
146

SEE ALSO

148       SbVec3f, SbMatrix
149
150
151
152
153                                                             SbRotation(3IV)()
Impressum