## Coordinate systems

Geometry undergoes a series of transformations before being rendered to the screen. This conversion process is used to move objects through various coordinate systems in the *projection pipeline* which starts with world space at one end, and culminates in pixel space (the picture on the screen) at the other. The pipeline is as follows:

### Object Coordinates

After graphics primitives are inserted into the HOOPS/3dGS database, they reside in a unitless infinite 3D Cartesian coordination system called 'object coordinates'. Each segment has its own local object coordinate system. Objects are then transformed from object coordinates into another coordinate system called *world coordinates* using the local modelling matrix contained set in the segment concatenated with any transforms from the parent segment. (Modelling matrices will be discussed in here)

### World Coordinates

This is another unitless infinite 3D Cartesian coordinate system where objects reside after having been transformed through their local modelling matrices. There is a single, global world coordinate system in the HOOPS/3dGS database. (This is sometimes referred to as camera coordinates.) This is the space viewed by cameras in the scene. A camera defines a particular view of the world coordinate system. This is the coordinate system where objects exist after local modeling transformations have been applied.

### Viewpoint Coordinates

The viewpoint coordinate system is orthogonal to the current view plane.

- The Z-axis is in the direction of the viewing vector
- Y-axis is in the direction of the up vector
- The origin is at the camera position

This system enables you to easily construct geometry in your current viewplane.

### Window Coordinates

Each camera projects its field of view into it's containing window. The window coordinate system is a 2D coordinate system which corresponds to the HOOPS window drawn on the screen. In window space, the top right of the window is 1,1 and the bottom left is -1, -1, and it's z-range is also -1, 1 (World space is normalized into the window coordinate system's z-range).

### Pixel Coordinates

After an object has been transformed based on the viewing transform defined by a camera and drawn on the screen, it ultimately resides in a 2D coordinate system called *screen coordinates*. This is also called *pixel coordinates*, since it corresponds with the physical pixels on the screen. This is also the coordinate system where GUI events are typically returned.

### Converting between coordinate systems

The function ::Compute_Coordinates provides support for converting between different coordinate systems. Typical uses include:

- Converting input from a GUI toolkit to actual position in scene; this involves converting from pixel coordinates to world coordinates
- Building geometry in construction plane; this involves converting from world coordinates to viewpoint coordinates, and then back to world coordinates