Transforms

A transformation or transform is something that changes a geometric shape. Moving a shape, rotating it, and resizing it are all types of transformations. You use transforms in YG to arrange objects in the scene. You can do this by using three messages in the object node: position, orientation, and size.

Position

Everything in the YG scene is arranged in a three-dimensional grid. A single point in space, or the location of an object, is defined by 3 coordinates: X, Y, and Z. In YG, the Origin (0,0,0) is the center of the scene, where you start out when the world is first loaded. The X and Y coordinates define a point's location on the ground plane: X determines distance left or right, and Y determines distance forward and backwards. The third coordinate, Z, defines height. (insert helpful illustration here).

So, for instance, the coordinates (-4, 7, 3) would define a point that is 4 feet to the left, 7 feet forward, and 3 feet off the ground. In many 3D graphics systems, coordinates don't actually have units - they're just numbers on a grid. Since the CAVE is designed to simulate actual spatial dimensions, everything is measured in feet.

object (file(apple.pfb),position(-4 7 3))

Size

You can scale, or change the size, of objects with the size message:

object (file(apple.pfb), size(2))

makes the apple twice its normal size, while

object (file(apple.pfb), size(.5))

makes it half the normal size. The numbers in the size message are relative, NOT absolute sizes. If the apple is normally 1 foot tall, then these two examples would make it 2 feet tall and six inches tall, respectively. But suppose you're using a more normal apple, one that's 4 inches high. Then size(2) will make it 8 inches high, while size(.5) makes it 2 inches.

How do you know how big it normally is? This is something that happens when you actually model the apple in your 3D modelling software. When you're using models from other sources, the units may not get interpreted correctly - you might get a model that is measured in centimeters, but ends up being displayed as though it were measured in feet, and is now ridiculously huge. The size() message can also help fix problems like that.

You can also scale an object differently on its X, Y, and Z axes:

object (file(apple.pfb),size(1 1 2))

makes a tall, thin apple.

NOTE: Don't use 0 for scale measurements - it makes the object disappear completely and sometimes causes strange errors!

Orientation

The orientation, or rotation, of an object is measured in degrees around each of the three axes.

object (file(arrow.pfb),orientation (0 0 45))

Rotation about the X axis, or "pitch", tilts an object up and down.

Rotation about the Y axis, or "roll", tilts an object from side to side.

Rotation about the Z axis, or "yaw", rotates an object from left to right.

Roll, Pitch, and Yaw are nautical and aeronautical terms. Among mathematicians, this way of defining orientation is also called the "Euler Angles." The place where they get tricky is when you use combinations of all three angles. If you rotate an object too far on multiple axes at once, it can get into something called "Gimbal Lock" where it seems to completely lock up.



(c) Ben Chang