# Coordinate Systems

## Motivation

When dealing with voxels (and math in three-dimensional space in general), it is extremely important to get your coordinate systems and the conversions between them right. Even slightly wrong conversions can (and will) lead to *massive* headaches and horrible debugging sessions.

As such, it is a good idea to do one or more of these:

- Add the coordinate-system being used to every position, rotation and scale value.
- Restrict the mixing of coordinate-systems, by using a type-system that let's you create new types from existing types.
- Document the coordinate-systems of function parameters.

## Terminology

Now then, let's get to the various coordinate systems!

**TODO:** Add descriptive diagrams to all definitions.

### World Space

The global coordinate system that is the entire scene. This is where almost all the (gameplay-related) math will occur.

Depending on the software you are using, this can vary *wildly*...

Cheat Sheet made by Freya Holmér © 2020

Wiki license exception: Copyright belongs to artist.

Copy embedded here with permission.

### Chunk/Object/Local Space

The local coordinate system of an individual chunk or object.

### Voxel Space

The inner coordinate system of an *individual voxel*.

### NDC Space

The global coordinate system, as seen by a camera with some projection applied.

### View Space

The global coordinate system, as seen by a camera, with *no* projection applied.