aboutsummaryrefslogtreecommitdiff
path: root/man/man3/qball.html
blob: b1403336a480ec1224d560798a6b1bac236e69fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<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 &ndash; 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 &lt;draw.h&gt; 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>#include &lt;geometry.h&gt; 
    <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>&#8217;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&#8217;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&#8217;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, &#8220;Animating Rotation with Quaternion Curves&#8221;, <i>SIGGRAPH
    &#8217;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>