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.
Orbit
] operation handler.Orbit
] operation handler behind cc
feature gate.First
] person view aka free look or mouse look wrt [Orbit
] operation handler.Frame
] with [Frame::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.Clamp
] operation handler ensuring user boundary conditions of observer [Frame
].Fixed
] quantities wrt to field of view, see [Scene::set_fov()
].Touch
] gesture recognition for slide, orbit, scale, and focus operations.See the release history to keep track of the development.
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.
```rust use trackball::{ nalgebra::{Point2, Vector3}, Frame, Image, Orbit, };
/// Trackball camera mode.
pub struct Trackball {
// Frame wrt camera eye and target.
frame: FrameScene
wrt Frame
.
image: Image
impl Trackball {
// Usually, a cursor position event with left mouse button being pressed.
fn handleleftbuttondisplacement(&mut self, pos: &Point2Self::handle_left_button_press()
.
self.orbit.discard();
}
}
```
Identical C11 implementation for [Orbit
] operation handler behind cc
feature gate:
toml
[dependencies]
trackball = { version = "0.10.0", features = ["cc"] }
Copyright © 2021-2023 Rouven Spreckels rs@qu1x.dev
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.