Opened 15 months ago

## #127 new enhancement

# Map Editor: Replace angles with quaternions

Reported by: | Carsten | Owned by: | |
---|---|---|---|

Priority: | normal | Milestone: | |

Component: | other | Version: | svn-head |

Keywords: | Cc: | ||

Platform: |

### Description

In the Map Editor and in the `.cmap` map files, we still use triples of *angles* (heading, pitch and bank) in order to describe the orientation of map primitives and map entities.

This however is fraught with problems: The use of angles suggests an intuitive and easy to understand method to specify the orientation of an object, but it turns out that that is a serious misconception.

Applying or using angles requires additional, implicit knowledge:

- In what order must the rotations about the angles be applied?
- Will a positive angle rotate clockwise or counter-clockwise?
- Do all-zero angles correspond to the identity transformation?

That is, both humans who read a `.cmap` file in a text editor as well as all any code that converts to and from angles must be acutely aware of these details, and follow them in the exact same manner.

As a result, for specifying the orientation of objects, we should replace angles with the basis vectors of the objects local system, or quaternions.

The use of basis vectors / the 3x3 rotation matrix would be straightforward and simple, but also be overly verbose and give room for new questions, e.g. what if we find a non-orthogonal basis in a map file?

Consequently, using quaternions as a robust, easy to understand and unambiguous method to express rotations / orientations, and their unequivocal conversions to and from rotation matrices, seems to be a logical step.

Note that the use of quaternions should only be "internally" -- graphical user interfaces in the Map Editor should still present angular representations of rotation to the user, and convert to and from quaternions as necessary.

**Note:**See TracTickets for help on using tickets.