260
APPENDIX E
• Transform(rotor) - Rotate by the given Rotation
• Transform(translateVec, rotor) - a translation of a rotation
• Transform(tfm1, tfm2) - tfm1 of tfm2 (apply tfm2, then tfm1)
• Transform(trans1, tfm2, rot3, tfm4, ...) - Any number of concatenations are allowed.
In this manner, multiple iterations of transforms are not in absolute coordinates, but are added relatively
• Transform(t1.toString()) - decoding from an encoded string.
critter.transform = Transform(critterSpot, Rotation('Y', critter.yRotation));
Properties
inverse
The inverse (opposite) of the transform.
// Relative transformation from a to b
rel = Transform(b, a.inverse);
rotation
The rotational component (Rotation) of the Transform.
// Normals only rotate.
newNorm = tfm.rotation.map(oldNorm);
translation
The translational component (Vector) of the Transform.
shadowPosition = tfm.translation.change(1.0, 0.0);
Methods
blend(Transform b, fl oat fraction)
Returns a Transform interpolated the specifi ed fraction (0.0 to 1.0) from a to b.
// 10% of the way from a to b
c = a.blend(b, 0.1);
map(vec)
Returns Vector 'vec' rotated and translated by this Transform.
forward = orientation.map(Vector(0.0, 0.0, -1.0));
power(pow)
Raises the Transform to the specifi ed power.
// b transforms 2.5 times as far as a.
b = a.power(2.5);
toString()
Returns the Transform encoded as a string. This provides a way in which transform information can be sent over
the chat line to another visitor in the same world. The receiving visitor can then decode the transform using this