Trackball¶
-
class
glumpy.transforms.
Trackball
(*args, **kwargs)¶ Bases:
glumpy.transforms.transform.Transform
3D trackball transform
Parameters: - aspect (float) – Indicate what is the aspect ratio of the object displayed. This is necessary to convert pixel drag move in oject space coordinates. Default is None.
- znear (float) – Near clip plane. Default is 2.
- zfar (float) – Distance clip plane. Default is 1000.
- theta (float) – Angle (in degrees) around the z axis. Default is 45.
- phi (float) – Angle (in degrees) around the x axis. Default is 45.
- distance (float) – Distance from the trackball to the object. Default is 8.
- zoom (float) – Zoom level. Default is 35.
The trackball transform simulates a virtual trackball (3D) that can rotate around the origin using intuitive mouse gestures.
The transform is connected to the following events:
on_attach
: Transform initializationon_resize
: Tranform update to maintain aspecton_mouse_scroll
: Zoom in & out (user action)on_mouse_grab
: Drag (user action)
Usage example:
vertex = ''' attribute vec2 position; void main() { gl_Position = <transform>(vec4(position, 0.0, 1.0)); } ''' ... window = app.Window(width=800, height=800) program = gloo.Program(vertex, fragment, count=4) ... program['transform'] = Trackball(aspect=1) window.attach(program['transform']) ...
-
aspect
¶ Projection aspect
-
distance
¶ Distance from the trackball to the object
-
phi
¶ Angle (in degrees) around the x axis
-
theta
¶ Angle (in degrees) around the z axis
-
zoom
¶ Angle (in degrees) around the x axis