CC3otator encapsulates the various mechanisms of rotating a node, and converts between them. More...
#import <CC3Node.h>
Public Member Functions | |
(void) | - applyRotationTo: |
(id) | - init |
(id) | - initOnRotationMatrix: |
(void) | - rotateBy: |
(void) | - rotateByAngle:aroundAxis: |
(void) | - rotateByQuaternion: |
Static Public Member Functions | |
(id) | + rotator |
(id) | + rotatorOnRotationMatrix: |
Properties | |
CC3Vector4 | quaternion |
CC3Vector | rotation |
GLfloat | rotationAngle |
CC3Vector | rotationAxis |
CC3GLMatrix * | rotationMatrix |
CC3otator encapsulates the various mechanisms of rotating a node, and converts between them.
Nodes delegate responsibility for managing their rotation to an encapsulated instance of CC3Rotator.
Rotations can be specified in any of the following methods:
The rotator maintains an internal rotationMatrix, separate from the node's transformMatrix, and the rotator can use this rotationMatrix to convert between different rotational specifications. As such, the rotation of a node can be set using any one of the above specifications, and read back as any of the other specifications.
- (void) applyRotationTo: | (CC3GLMatrix *) | aMatrix |
Applies the rotationMatrix to the specified transform matrix.
This is accomplished by multiplying the transform matrix by the rotationMatrix. This method is invoked automatically from the applyRotation method of the node. Usually, the application never needs to invoke this method directly.
- (id) init |
Initializes this instance with an identity rotationMatrix.
- (id) initOnRotationMatrix: | (CC3GLMatrix *) | aGLMatrix |
Initializes this instance to use the specified matrix as the rotationMatrix.
- (void) rotateBy: | (CC3Vector) | aRotation |
Rotates this rotator from its current state by the specified Euler angles in degrees.
- (void) rotateByAngle: | (GLfloat) | anAngle | |
aroundAxis: | (CC3Vector) | anAxis | |
Rotates this rotator from its current state by rotating around the specified axis by the specified angle in degrees.
- (void) rotateByQuaternion: | (CC3Vector4) | aQuaternion |
Rotates this rotator from its current state by the specified quaternion.
+ (id) rotator |
Allocates and initializes an autoreleased instance with an identity rotationMatrix.
+ (id) rotatorOnRotationMatrix: | (CC3GLMatrix *) | aGLMatrix |
Allocates and initializes an autoreleased instance to use the specified matrix as the rotationMatrix.
- (CC3Vector4) quaternion [read, write, assign] |
The rotation of the node in 3D space, relative to the parent of this node, expressed as a quaternion.
- (CC3Vector) rotation [read, write, assign] |
The rotational orientation of the node in 3D space, relative to the parent of the node.
This value contains three Euler angles, defining a rotation of this node around the X, Y and Z axes. Each angle is specified in degrees.
Rotation is performed in Y-X-Z order, which is the OpenGL default. Depending on the nature of the object you are trying to control, you can think of this order as yaw, then pitch, then roll, or heading, then inclination, then tilt,
When setting this value, each component is converted to modulo +/-360 degrees.
- (GLfloat) rotationAngle [read, write, assign] |
The angular rotation around the axis specified in the rotationAxis property.
When setting this value, it is converted to modulo +/-360 degrees.
- (CC3Vector) rotationAxis [read, write, assign] |
The axis of rotation of the node in 3D space, relative to the parent of this node, expressed as a directional vector.
This axis can be used in conjunction with the rotationAngle property to describe the rotation as a single angular rotation around an arbitrary axis.
- (CC3GLMatrix *) rotationMatrix [read, write, retain] |
The rotation matrix derived from the rotation or quaternion properties.
Rotation can be specified in terms of either of these properties, and read by either property, even if set by the other property. The matrix will reflect the rotational property most recently set.
The rotation matrix for each instance is local to the node and does not include rotational information about the node's ancestors.