Trackball class for 3D manipulation of viewpoints.
- class trimesh.viewer.trackball.Trackball(pose, size, scale, target=None)#
A trackball class for creating camera transforms from mouse movements.
- STATE_PAN = 1#
- STATE_ROLL = 2#
- STATE_ROTATE = 0#
- STATE_ZOOM = 3#
- __init__(pose, size, scale, target=None)#
Initialize a trackball with an initial camera-to-world pose and the given parameters.
pose ([4,4]) – An initial camera-to-world pose for the trackball.
size ((float, float)) – The width and height of the camera image in pixels.
scale (float) – The diagonal of the scene’s bounding box – used for ensuring translation motions are sufficiently fast for differently-sized scenes.
target ((3,) float) – The center of the scene in world coordinates. The trackball will revolve around this point.
Record an initial mouse press at a given point.
point ((2,) int) – The x and y pixel coordinates of the mouse press.
Update the tracball during a drag.
point ((2,) int) – The current x and y pixel coordinates of the mouse during a drag. This will compute a movement for the trackball with the relative motion between this point and the one marked by down().
- property pose#
The current camera-to-world pose.
Resize the window.
size ((float, float)) – The new width and height of the camera image in pixels.
- rotate(azimuth, axis=None)#
Rotate the trackball about the “Up” axis by azimuth radians.
azimuth (float) – The number of radians to rotate.
Zoom using a mouse scroll wheel motion.
clicks (int) – The number of clicks. Positive numbers indicate forward wheel movement.
Set the state of the trackball in order to change the effect of dragging motions.
state (int) – One of Trackball.STATE_ROTATE, Trackball.STATE_PAN, Trackball.STATE_ROLL, and Trackball.STATE_ZOOM.