pqp
 All Classes
PQP_Compile.h
1 /*************************************************************************\
2 
3  Copyright 1999 The University of North Carolina at Chapel Hill.
4  All Rights Reserved.
5 
6  Permission to use, copy, modify and distribute this software and its
7  documentation for educational, research and non-profit purposes, without
8  fee, and without a written agreement is hereby granted, provided that the
9  above copyright notice and the following three paragraphs appear in all
10  copies.
11 
12  IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE
13  LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
14  CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
15  USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
16  OF NORTH CAROLINA HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
17  DAMAGES.
18 
19  THE UNIVERSITY OF NORTH CAROLINA SPECIFICALLY DISCLAIM ANY
20  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
22  PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
23  NORTH CAROLINA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
24  UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 
26  The authors may be contacted via:
27 
28  US Mail: S. Gottschalk, E. Larsen
29  Department of Computer Science
30  Sitterson Hall, CB #3175
31  University of N. Carolina
32  Chapel Hill, NC 27599-3175
33 
34  Phone: (919)962-1749
35 
36  EMail: geom@cs.unc.edu
37 
38 
39 \**************************************************************************/
40 
41 #ifndef PQP_COMPILE_H
42 #define PQP_COMPILE_H
43 
44 // prevents compiler warnings when PQP_REAL is float
45 
46 #include <math.h>
47 /*inline float sqrt(float x) { return (float)sqrt((double)x); }
48 inline float cos(float x) { return (float)cos((double)x); }
49 inline float sin(float x) { return (float)sin((double)x); }
50 inline float fabs(float x) { return (float)fabs((double)x); }
51 */
52 //-------------------------------------------------------------------------
53 //
54 // PQP_REAL
55 //
56 // This is the floating point type used throughout PQP. doubles are
57 // recommended, both for their precision and because the software has
58 // mainly been tested using them. However, floats appear to be faster
59 // (by 60% on some machines).
60 //
61 //-------------------------------------------------------------------------
62 
63 typedef double PQP_REAL;
64 
65 //-------------------------------------------------------------------------
66 //
67 // PQP_BV_TYPE
68 //
69 // PQP introduces a bounding volume (BV) type known as the "rectangle
70 // swept sphere" (RSS) - the volume created by sweeping a sphere so
71 // that its center visits every point on a rectangle; it looks
72 // something like a rounded box.
73 //
74 // In our experiments, the RSS type is comparable to the oriented
75 // bounding box (OBB) in terms of the number of BV-pair and triangle-pair
76 // tests incurred. However, with our present implementations, overlap
77 // tests are cheaper for OBBs, while distance tests are cheaper for the
78 // RSS type (we used a public gjk implementation for the OBB distance test).
79 //
80 // Consequently, PQP is configured to use the RSS type in distance and
81 // tolerance queries (which use BV distance tests) and to use OBBs for
82 // collision queries (which use BV overlap tests). Using both requires six
83 // more PQP_REALs per BV node than using just one type.
84 //
85 // To save space, you can configure PQP to use only one type, however,
86 // with RSS alone, collision queries will typically be slower. With OBB's
87 // alone, distance and tolerance queries are currently not supported, since
88 // we have not developed our own OBB distance test. The three options are:
89 //
90 // #define PQP_BV_TYPE RSS_TYPE
91 // #define PQP_BV_TYPE OBB_TYPE
92 // #define PQP_BV_TYPE RSS_TYPE | OBB_TYPE
93 //
94 //-------------------------------------------------------------------------
95 
96 #define RSS_TYPE 1
97 #define OBB_TYPE 2
98 
99 #define PQP_BV_TYPE RSS_TYPE | OBB_TYPE
100 
101 #endif