# Motivation

• By default, all shapes are built at the center of the world
• A Transform enables you to
• Position shapes
• Rotate shapes
• Scale shapes

# Using coordinate systems

• A X3D file builds components for a world
• A file's world components are built in the file's world coordinate system
• By default, all shapes are built at the origin of the world coordinate system

# Transforming a coordinate system

A transform creates a coordinate system that is

• Positioned
• Rotated
• Scaled

relative to a parent coordinate system

Shapes built in the new coordinate system are positioned, rotated, and scaled along with it

# Syntax: Transform

The Transform group node creates a group with its own coordinate system

• translation - position
• rotation - orientation
• scale - size
• children - shapes to build

# Including children

The children field includes a list of one or more nodes

# Translating

Translation positions a coordinate system in X, Y, and Z.

# Rotating

Rotation orients a coordinate system about a rotation axis by a rotation angle

• Angles are measured in radians
• radians = degrees / 180.0 * 3.1415927

# Specifying rotation axes

• A rotation axis defines a pole to rotate around
• Like the Earth's North-South pole

Typical rotations are about the X, Y, or Z axes:

X-Axis 1.0 0.0 0.0
Y-Axis 0.0 1.0 0.0
Z-Axis 0.0 0.0 1.0

# Using the Right-Hand Rule

Positive rotations are counter-clockwise

To help remember positive and negative rotation directions:

• Aim your thumb in an axis positive direction
• Curl your fingers around the axis
• The curl direction is a positive rotation

# Scaling

Scale grows or shrinks a coordinate system by a scaling factor in X, Y, and Z.

# Scaling, rotating, and translating

Scale, Rotate, and Translate a coordinate system, one after the other.

## Classic Encoding

• The children are scaled, rotated, then translated
• Order is fixed, independent of field order

# Summary

• All shapes are built in a coordinate system
• The Transform node creates a new coordinate system relative to its parent
• Transform node fields do
• translation
• rotation
• scale