Last modified 7 August 2003 by jdavis@math.wisc.edu
Inherits from SMKTransformation : NSObject
Conforms to NSCoding, NSCopying
SMKAxisTransformation is a concrete subclass of SMKTransformation, in which the rotational part consists of a single rotation about an arbitrary axis. Any rotation can be expressed in this way. You can set the angle and axis yourself, or you can construct them by composing a sequence of such rotations.
Our first four methods control the axis of rotation. It is expressed as a vector, which must always have length 1.
- (id)setAxis:(double *)axis;Sets the axis of rotation.
Returns the axis of rotation in the passed vector.
- (id)setAxis:(unsigned int)index toValue:(double)value;
Sets the X, Y, or Z component of the axis of rotation, when passed 0, 1, or 2, respectively.
- (double)axis:(unsigned int)index;
Returns the X, Y, or Z component of the axis of rotation, when passed 0, 1, or 2, respectively.
Our next two methods control the angle of rotation. The rotation is always counter-clockwise about the axis, oriented according to the right-hand rule. The angle is in radians.
- (id)setAngle:(double)angle;Sets the angle of rotation.
Returns the angle of rotation.
The next two methods compose the receiving rotation with another one-axis rotation.
- (id)appendRotationByAngle:(double)angle axis:(double *)axis;Sets the receiver to the composition of the receiver and the given one-axis rotation. That is, if the receiver is TR and a rotation R' is specified, then the receiver becomes TRR'.
- (id)prependRotationByAngle:(double)angle axis:(double *)axis;
Prepends the receiver's rotation with the given one. That is, the receiver becomes TR'R.
Of course, much of SMKAxisTransformation's work is done in overridden methods. Its version of makeVector:andVector:rotateToTarget:andTarget: always succeeds. It implements makeVector:rotateToTarget: to use the smallest possible rotation.
If the SMKAxisTransformation represents the transformation at a node in an SMKSceneTree, then in various situations you might like it to respond to setPlanarAngle: by storing the given angle, its supplementary angle, or the negative of one of those. The following methods let you choose the angle or its supplement. If you'd like one of the negatives, simply negate the axis vector, which is equivalent to negating the angle.
- (id)setPlanarAngleBehavior:(int)behavior;Tells the receiver to respond to subsequent invocations of setPlanarAngle: by storing (via setAngle:) the given angle or its supplement. Valid arguments are SMKGivenPlanarAngle (the default) and SMKSupplementaryPlanarAngle.
Returns the current planar angle behavior.