3 qball \- 3-d rotation controller
12 void qball(Rectangle r, Mouse *mousep,
15 Quaternion *orientation,
18 void (*redraw)(void), Quaternion *ap)
21 is an interactive controller that allows arbitrary 3-space rotations to be specified with
22 the mouse. Imagine a sphere with its center at the midpoint of rectangle
24 and diameter the smaller of
26 dimensions. Dragging from one point on the sphere to another specifies the endpoints of a
27 great-circle arc. (Mouse points outside the sphere are projected to the nearest point
28 on the sphere.) The axis of rotation is normal to the plane of the arc, and the
29 angle of rotation is twice the angle of the arc.
33 is a pointer to the mouse event that triggered the interaction. It should
36 will read more events into
38 and return when no buttons are down.
42 is reading mouse events, it calls out to the caller-supplied routine
44 which is expected to update the screen to reflect the changing orientation.
47 is the orientation that
49 should examine, represented as a unit Quaternion (see
51 The caller may set it to any orientation.
52 It will be updated before each call to
54 (and on return) by multiplying by the rotation specified with the mouse.
56 It is possible to restrict
58 attention to rotations about a particular axis.
61 is null, the rotation is unconstrained.
62 Otherwise, the rotation will be about the same axis as
64 This is accomplished by projecting points on the sphere to
65 the nearest point also on the plane through the sphere's center
66 and normal to the axis.
68 .B /sys/src/libgeometry/qball.c
73 ``Animating Rotation with Quaternion Curves'',
75 SIGGRAPH '85 Conference Proceedings.