trimesh.viewer.trackball module

Trackball class for 3D manipulation of viewpoints.

Classes

Trackball(pose, size, scale[, target])

A trackball class for creating camera transforms from mouse movements.

class trimesh.viewer.trackball.Trackball(pose, size, scale, target=array([0., 0., 0.]))

Bases: object

A trackball class for creating camera transforms from mouse movements.

Attributes

STATE_PAN

int(x=0) -> integer

STATE_ROLL

int(x=0) -> integer

STATE_ROTATE

int(x=0) -> integer

STATE_ZOOM

int(x=0) -> integer

pose

The current camera-to-world pose.

Methods

down(point)

Record an initial mouse press at a given point.

drag(point)

Update the tracball during a drag.

resize(size)

Resize the window.

rotate(azimuth[, axis])

Rotate the trackball about the “Up” axis by azimuth radians.

scroll(clicks)

Zoom using a mouse scroll wheel motion.

set_state(state)

Set the state of the trackball in order to change the effect of dragging motions.

STATE_PAN = 1
STATE_ROLL = 2
STATE_ROTATE = 0
STATE_ZOOM = 3
down(point)

Record an initial mouse press at a given point.

Parameters

point ((2,) int) – The x and y pixel coordinates of the mouse press.

drag(point)

Update the tracball during a drag.

Parameters

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.

Type

autolab_core.RigidTransform

resize(size)

Resize the window.

Parameters

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.

Parameters

azimuth (float) – The number of radians to rotate.

scroll(clicks)

Zoom using a mouse scroll wheel motion.

Parameters

clicks (int) – The number of clicks. Positive numbers indicate forward wheel movement.

set_state(state)

Set the state of the trackball in order to change the effect of dragging motions.

Parameters

state (int) – One of Trackball.STATE_ROTATE, Trackball.STATE_PAN, Trackball.STATE_ROLL, and Trackball.STATE_ZOOM.