Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thus the popularity of unit quaternions in 3D simulation and graphics. They cover the sphere twice, so each rotation can be represented by two possible values.

My hack minds eye view of this is that you take two combed layers with nulls at the poles. The rotation then jumps between layers as it crosses the poles.



Could you explain in more detail? Why do people in 3d simulations and graphics care about the existence of a point where the function value is 0?


They want a rotation representation that:

1) can be accumulated (quaternion multiplication) and interpolated (slerp) 'smoothly',

2) and in a way that does not depend on the absolute orientation.

- Smooth:

If you dive in and start using 3 angles (yaw,pitch,roll) to represent 3d rotation, then the rotations are like the hairy ball - however you order them, there will be values where you can't easily step to another physically very close rotation without a huge change in values - the discontinuities in the hairy ball.

This is classically called 'gimbal lock', where a gimbal mount is a physical manifestation of angle representation. In simulations, it might show itself as strange behaviour when pitched up/down close to 90deg, or an interpolation between apparently close rotations going wild.

By using unit quaternions (4 values), and avoiding the discontinuties (but now having two representations for each physical rotation) it becomes easy to acuumulate the rotations that come from a flight model, animation, user etc. without out ever getting stuck in a corner.

- Independant of absolute rotation:

A related point is that an incremental rotation by multiplying quaternions will always produce the same relative rotation irrespective of absolute attitude. You can see angle based represetnations going wrong when, for example, a camera control system offers buttons that are suposed to be left/right/up/down relative to the camera, but produce varying results as the camera rotates.

It's possible to do the same things with 3x3 matrices - but it is a bit more tricky to keep them normalised over time, and obviously takes more storage. A typical solution to all the above angle problems in a simulation would be to convert (yaw, pitch, roll) to a matrix, accumulate, then convert back. My brief experience of aerodynamics texts is that all the equations are obfuscated with unpicking and rebuilding angles. It's a bit like doing arithmentic with Roman numerals - possible, but painful.


Thanks for taking the time to explain this!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: