add .gitignore
[xgalaxy.git] / trackball.h
1 #ifndef __TRACKBALL_H__
2 #define __TRACKBALL_H__
3 /*
4  * (c) Copyright 1993, 1994, Silicon Graphics, Inc.
5  * ALL RIGHTS RESERVED
6  * Permission to use, copy, modify, and distribute this software for
7  * any purpose and without fee is hereby granted, provided that the above
8  * copyright notice appear in all copies and that both the copyright notice
9  * and this permission notice appear in supporting documentation, and that
10  * the name of Silicon Graphics, Inc. not be used in advertising
11  * or publicity pertaining to distribution of the software without specific,
12  * written prior permission.
13  *
14  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
15  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
16  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
17  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
18  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
19  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
20  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
21  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
22  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
23  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
24  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
25  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
26  *
27  * US Government Users Restricted Rights
28  * Use, duplication, or disclosure by the Government is subject to
29  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
30  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
31  * clause at DFARS 252.227-7013 and/or in similar or successor
32  * clauses in the FAR or the DOD or NASA FAR Supplement.
33  * Unpublished-- rights reserved under the copyright laws of the
34  * United States.  Contractor/manufacturer is Silicon Graphics,
35  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
36  *
37  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
38  */
39 /*
40  * trackball.h
41  * A virtual trackball implementation
42  * Written by Gavin Bell for Silicon Graphics, November 1988.
43  */
44
45 #include "xgalaxy.h"
46
47 /*
48  * Pass the x and y coordinates of the last and current positions of
49  * the mouse, scaled so they are from (-1.0 ... 1.0).
50  *
51  * The resulting rotation is returned as a quaternion rotation in the
52  * first paramater.
53  */
54 void
55 trackball(Quaternion *a, double p1x, double p1y, double p2x, double p2y);
56
57 /*
58  * This function computes a quaternion based on an axis (defined by
59  * the given vector) and an angle about which to rotate.  The angle is
60  * expressed in radians.  The result is put into the third argument.
61  */
62 void
63 axis_to_quat(Vector *a, double phi, Quaternion *q);
64
65 #endif