Public Member Functions | Static Public Member Functions | Properties

CC3Rotator Class Reference

CC3otator encapsulates the various mechanisms of rotating a node, and converts between them. More...

#import <CC3Rotator.h>

Inheritance diagram for CC3Rotator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

(void) - applyRotationTo:
(NSString *) - fullDescription
(void) - populateFrom:
(CC3Vector- transformDirection:

Static Public Member Functions

(id) + rotator

Properties

BOOL isDirectional
BOOL isMutable
BOOL isTargettable
CC3Quaternion quaternion
CC3Vector rotation
GLfloat rotationAngle
CC3Vector rotationAxis
CC3MatrixrotationMatrix
BOOL shouldAutotargetCamera
BOOL shouldRotateToTargetLocation
BOOL shouldTrackTarget
CC3Nodetarget

Detailed Description

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.

Depending on the rotator subclass, rotations can be read in any of the following forms:

This base class represents a read-only rotator and performs only identity rotations. It's primary purpose is to save memory in nodes that do not require any rotation.

The CC3MutableRotator class adds the ability to set rotations, and is more commonly used. The CC3DirectionalRotator class further adds directional rotational mechanisms (such as rotating to look in a particular direction), and the CC3TargetttingRotator extends this to rotating to look at a particular target location or node, and optionally track that target location or node as it or the node of the rotator move around.


Member Function Documentation

- (void) applyRotationTo: (CC3Matrix *)  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.

- (NSString*) fullDescription

Returns a string containing a more complete description of this rotator, including rotation properties.

- (void) populateFrom: (CC3Rotator *)  another

Template method that populates this instance from the specified other instance.

This method is invoked automatically during object copying via the copy or copyWithZone: method. In most situations, the application should use the copy method, and should never need to invoke this method directly.

Subclasses that add additional instance state (instance variables) should extend copying by overriding this method to copy that additional state. Superclass that override this method should be sure to invoke the superclass implementation to ensure that superclass state is copied as well.

+ (id) rotator

Allocates and initializes an autoreleased instance with an identity rotationMatrix.

- (CC3Vector) transformDirection: (CC3Vector aDirection

Rotates the specified direction vector, and returns the transformed direction.


Property Documentation

- (BOOL) isDirectional [read, assign]

Indicates whether this rotator supports rotating to point towards a specific direction (ie- "look-towards").

This implementation always returns NO. Subclasses that support pointing towards a specific direction will override.

Implemented in CC3DirectionalRotator.

- (BOOL) isMutable [read, assign]

Indicates whether this rotator supports changing rotation properties, including rotation, quaternion, rotationAxis, and rotationAngle, and supports incremental rotation through the rotateBy...family of methods.

This implementation always returns NO. Subclasses that support changing rotation properties will override.

- (BOOL) isTargettable [read, assign]

Indicates whether this rotator supports rotating to point towards a specific target node or target location (ie- "look-at"), including.

This implementation always returns NO. Subclasses that support targetting a specific direction will override.

Implemented in CC3TargettingRotator.

- (CC3Quaternion) quaternion [read, assign]

The rotation of the node in 3D space, relative to the parent of this node, expressed as a quaternion.

This base class always returns kCC3QuaternionIdentity.

Implemented in CC3MutableRotator.

- (CC3Vector) rotation [read, 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,

This base class always returns kCC3VectorZero.

Implemented in CC3MutableRotator.

- (GLfloat) rotationAngle [read, assign]

The angular rotation around the axis specified in the rotationAxis property.

This base class always returns zero.

Implemented in CC3MutableRotator.

- (CC3Vector) rotationAxis [read, 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.

This base class always returns kCC3VectorZero.

Implemented in CC3MutableRotator.

- (CC3Matrix*) rotationMatrix [read, 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 base class always returns nil. Subclasses that support changing rotation will override.

Implemented in CC3MutableRotator.

- (BOOL) shouldAutotargetCamera [read, assign]

Indicates whether the node should automatically find and track the camera as its target.

If this property is set to YES, the node will automatically find and track the camera without having to set the target and shouldTrackTarget properties explicitly.

Always returns NO. Subclasses that support target tracking will override.

Implemented in CC3MutableRotator, and CC3TargettingRotator.

- (BOOL) shouldRotateToTargetLocation [read, assign]

Returns whether the node should rotate to face a target location.

This implementation always returns NO. Subclasses that support target locations will override.

Implemented in CC3TargettingRotator.

- (BOOL) shouldTrackTarget [read, assign]

Indicates whether the node should track the node set in the target property as the target and the node carrying this rotator move around.

Always returns NO. Subclasses that support target tracking will override.

Implemented in CC3MutableRotator, and CC3TargettingRotator.

- (CC3Node*) target [read, assign]

The target node at which this rotator is pointed.

Always returns nil. Subclasses that support target tracking will override.

Implemented in CC3TargettingRotator.


The documentation for this class was generated from the following file: