21 Scene
21.01 Scene and Coordinate type
A scene is a vector space of . We fix the right-handed orientation and an orthonormal basis, labeled , , and . A point in the space can be expressed as a 3-tuple , where , , and are real numbers.
A Coordinate type represents a point in the scene and is an array of three real numbers. It is represented as
type Coordinate = [number, number, number]
where the three numbers correspond to , , and , in this order.
The ground plane is the subspace of the scene spanned by the basis and , i.e., the set . The up direction is defined as the positive direction of the basis vector .
21.02 Coordinate Transformation
A coordinate transformation with uniform scale in the scene defined above transforms a vector to , where is a rotation operator, is a real number for uniform scale, and is the translation of the origin. Such a transformation can therefore be encoded in three pieces of information: translation , rotation , and scale .
21.02.01 Rotation and Euler Type
Rotation can be represented by the type Euler, specifying the Euler angles as a 3-tuple in radians. The rotations are applied in the order of the -axis, then the -axis, then the -axis. It can be represented as
type Euler = [number, number, number]
where the three numbers correspond to rotation in radians around the -axis, -axis, and -axis, in that order. For each rotation, a positive value means counterclockwise rotation. A zero rotation on all axes implies that the axes of the transformed coordinate align with those of the scene coordinate.
21.02.02 Scale and Scale Type
The type Scale represents the scaling of the transformed coordinate about its local origin and is a real number, where a value of 1 means no scaling. It can be represented as
type Scale = number
21.02.03 Local Coordinate
A coordinate distinct from the scene coordinate, also referred to as the global coordinate, is called a local coordinate. A local coordinate can be defined by the coordinate transformation above with respect to the scene coordinate, or can be specified by the origin of the local coordinate in the scene coordinate along with the transformed basis; see Section TODO: local scene.
21.03 Entity in the scene
Each entity in the scene comes with its own local coordinate, and its placement can therefore be described by the three pieces of information defined in Section 21.02. That is, one starts with the entity's local coordinate coinciding with the scene coordinate, then applies the transformation defined in Section 21.02 to the entity.