trackball
Virtual Trackball Orbiting via the Exponential Map
This is an alternative trackball technique using exponential map and parallel transport to preserve distances and angles for inducing coherent and intuitive trackball rotations. For instance, displacements on straight radial lines through the screen's center are carried to arcs of the same length on great circles of the trackball. This is in contrast to state-of-the-art techniques using orthogonal projection which distorts radial distances further away from the screen's center. This implementation strictly follows the recipe given in the paper of Stantchev, G.. “Virtual Trackball Modeling and the Exponential Map.” . S2CID 44199608.
Features
- Common trackball operations split into several operation handlers.
- Coherent and intuitive orbiting via the exponential map, see
Orbitoperation handler. - Identical C11 implementation for
Orbitoperation handler behindccfeature gate. - Observer
FramewithFrame::slide(),Frame::orbit(),Frame::scale()operations in world space and their local complements in camera space. - Object inspection mode scaling clip plane distances by measuring from target instead of eye.
Clampoperation handler ensuring user boundary conditions of observerFrame.- Scale-preserving transitioning between orthographic and perspective projection mode.
- Time-free touch gesture recognition for slide, orbit, scale, and focus operations.
Example
A trackball camera mode implementation can be as easy as this by delegating events of your 3D
graphics library of choice to the Orbit operation handler along with other handlers.
use ;
use PI;
use ;
/// Trackball camera mode.
C11 Implementation
Identical C11 implementation for Orbit operation handler behind cc feature gate:
[]
= { = "0.2", = ["cc"] }
License
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the works by you shall be licensed as above, without any additional terms or conditions.