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. - Coherent
Firstperson view aka free look or mouse look wrtOrbitoperation handler. - Observer
FramewithFrame::slide(),Frame::orbit(),Frame::scale()operations in world space and their local complements in camera space and with orbit and slide operations around arbitrary points in either world or camera space. Clampoperation handler ensuring user boundary conditions of observerFrame.- Object inspection mode scaling clip plane distances by measuring from target instead of eye.
- Scale-preserving transitioning between orthographic and perspective projection mode.
- Converting between
Fixedquantities wrt to field of view, seeScene::set_fov(). - Time-free
Touchgesture recognition for slide, orbit, scale, and focus operations.
See the release history to keep track of the development.
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 ;
/// Trackball camera mode.
C11 Implementation
Identical C11 implementation for Orbit operation handler behind cc feature gate:
[]
= { = "0.6", = ["cc"] }
License
The works are licensed under the BSD-2-Clause-Patent.
This license is designed to provide:
- a simple permissive license,
- that is compatible with the
GPL-2.0-or-later, and - which also has an express patent grant included, but
- unlike the
Apache-2.0without patent retaliation.
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.