| <head> |
| <title>qball(3) - Plan 9 from User Space</title> |
| <meta content="text/html; charset=utf-8" http-equiv=Content-Type> |
| </head> |
| <body bgcolor=#ffffff> |
| <table border=0 cellpadding=0 cellspacing=0 width=100%> |
| <tr height=10><td> |
| <tr><td width=20><td> |
| <tr><td width=20><td><b>QBALL(3)</b><td align=right><b>QBALL(3)</b> |
| <tr><td width=20><td colspan=2> |
| <br> |
| <p><font size=+1><b>NAME </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| qball – 3-d rotation controller<br> |
| |
| </table> |
| <p><font size=+1><b>SYNOPSIS </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>#include <draw.h> |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>#include <geometry.h> |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>void qball(Rectangle r, Mouse *mousep,<br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| Quaternion *orientation,<br> |
| void (*redraw)(void), Quaternion *ap)<br> |
| |
| </table> |
| </font></tt> |
| </table> |
| <p><font size=+1><b>DESCRIPTION </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <i>Qball</i> is an interactive controller that allows arbitrary 3-space |
| rotations to be specified with the mouse. Imagine a sphere with |
| its center at the midpoint of rectangle <i>r</i>, and diameter the smaller |
| of <i>r</i>’s dimensions. Dragging from one point on the sphere to another |
| specifies the endpoints of a great-circle arc. (Mouse |
| points outside the sphere are projected to the nearest point on |
| the sphere.) The axis of rotation is normal to the plane of the |
| arc, and the angle of rotation is twice the angle of the arc. |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| Argument <i>mousep</i> is a pointer to the mouse event that triggered |
| the interaction. It should have some button set. <i>Qball</i> will read |
| more events into <i>mousep</i>, and return when no buttons are down. |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| While <i>qball</i> is reading mouse events, it calls out to the caller-supplied |
| routine <i>redraw</i>, which is expected to update the screen to reflect |
| the changing orientation. Argument <i>orientation</i> is the orientation |
| that <i>redraw</i> should examine, represented as a unit Quaternion (see |
| <i>quaternion(9.2)).</i> The caller may set it to any |
| orientation. It will be updated before each call to <i>redraw</i> (and |
| on return) by multiplying by the rotation specified with the mouse. |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| It is possible to restrict <i>qball’s</i> attention to rotations about |
| a particular axis. If <i>ap</i> is null, the rotation is unconstrained. |
| Otherwise, the rotation will be about the same axis as <i>*ap</i>. This |
| is accomplished by projecting points on the sphere to the nearest |
| point also on the plane through the sphere’s center and normal |
| to |
| the axis.<br> |
| |
| </table> |
| <p><font size=+1><b>SOURCE </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>/usr/local/plan9/src/libgeometry/qball.c<br> |
| </font></tt> |
| </table> |
| <p><font size=+1><b>SEE ALSO </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <a href="../man3/quaternion.html"><i>quaternion</i>(3)</a><br> |
| Ken Shoemake, “Animating Rotation with Quaternion Curves”, <i>SIGGRAPH |
| ’85 Conference Proceedings.<br> |
| </i> |
| </table> |
| |
| <td width=20> |
| <tr height=20><td> |
| </table> |
| <!-- TRAILER --> |
| <table border=0 cellpadding=0 cellspacing=0 width=100%> |
| <tr height=15><td width=10><td><td width=10> |
| <tr><td><td> |
| <center> |
| <a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a> |
| </center> |
| </table> |
| <!-- TRAILER --> |
| </body></html> |