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: |
Static Public Member Functions | |
(id) | + rotator |
(id) | + rotatorOnRotationMatrix: |
Properties | |
CC3Vector4 | quaternion |
CC3Vector | rotation |
CC3GLMatrix * | rotationMatrix |
Nodes delegate responsibility for managing their rotation to an encapsulated instance of CC3Rotator.
Rotations can be specified in terms of three Euler angles or quaternions. Subclasses may also specify other rotational mechanisms (such as pointing).
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 specified as a quaternion, and then read back as a set of Euler angles, or vice versa.
- (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.
+ (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 nodearound the X, Y and Z axes. Each angle is specified in degrees.
- (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.
This matrix is recalculated by invoking applyRotation, which is invoked automatically by the node.