00001 /*************************************************************************\ 00002 00003 Copyright 1999 The University of North Carolina at Chapel Hill. 00004 All Rights Reserved. 00005 00006 Permission to use, copy, modify and distribute this software and its 00007 documentation for educational, research and non-profit purposes, without 00008 fee, and without a written agreement is hereby granted, provided that the 00009 above copyright notice and the following three paragraphs appear in all 00010 copies. 00011 00012 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE 00013 LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR 00014 CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE 00015 USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY 00016 OF NORTH CAROLINA HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH 00017 DAMAGES. 00018 00019 THE UNIVERSITY OF NORTH CAROLINA SPECIFICALLY DISCLAIM ANY 00020 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 00022 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 00023 NORTH CAROLINA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, 00024 UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 00025 00026 The authors may be contacted via: 00027 00028 US Mail: S. Gottschalk, E. Larsen 00029 Department of Computer Science 00030 Sitterson Hall, CB #3175 00031 University of N. Carolina 00032 Chapel Hill, NC 27599-3175 00033 00034 Phone: (919)962-1749 00035 00036 EMail: geom@cs.unc.edu 00037 00038 00039 \**************************************************************************/ 00040 00041 #ifndef PQP_COMPILE_H 00042 #define PQP_COMPILE_H 00043 00044 // prevents compiler warnings when PQP_REAL is float 00045 00046 #include <math.h> 00047 inline float sqrt(float x) { return (float)sqrt((double)x); } 00048 inline float cos(float x) { return (float)cos((double)x); } 00049 inline float sin(float x) { return (float)sin((double)x); } 00050 inline float fabs(float x) { return (float)fabs((double)x); } 00051 00052 //------------------------------------------------------------------------- 00053 // 00054 // PQP_REAL 00055 // 00056 // This is the floating point type used throughout PQP. doubles are 00057 // recommended, both for their precision and because the software has 00058 // mainly been tested using them. However, floats appear to be faster 00059 // (by 60% on some machines). 00060 // 00061 //------------------------------------------------------------------------- 00062 00063 typedef double PQP_REAL; 00064 00065 //------------------------------------------------------------------------- 00066 // 00067 // PQP_BV_TYPE 00068 // 00069 // PQP introduces a bounding volume (BV) type known as the "rectangle 00070 // swept sphere" (RSS) - the volume created by sweeping a sphere so 00071 // that its center visits every point on a rectangle; it looks 00072 // something like a rounded box. 00073 // 00074 // In our experiments, the RSS type is comparable to the oriented 00075 // bounding box (OBB) in terms of the number of BV-pair and triangle-pair 00076 // tests incurred. However, with our present implementations, overlap 00077 // tests are cheaper for OBBs, while distance tests are cheaper for the 00078 // RSS type (we used a public gjk implementation for the OBB distance test). 00079 // 00080 // Consequently, PQP is configured to use the RSS type in distance and 00081 // tolerance queries (which use BV distance tests) and to use OBBs for 00082 // collision queries (which use BV overlap tests). Using both requires six 00083 // more PQP_REALs per BV node than using just one type. 00084 // 00085 // To save space, you can configure PQP to use only one type, however, 00086 // with RSS alone, collision queries will typically be slower. With OBB's 00087 // alone, distance and tolerance queries are currently not supported, since 00088 // we have not developed our own OBB distance test. The three options are: 00089 // 00090 // #define PQP_BV_TYPE RSS_TYPE 00091 // #define PQP_BV_TYPE OBB_TYPE 00092 // #define PQP_BV_TYPE RSS_TYPE | OBB_TYPE 00093 // 00094 //------------------------------------------------------------------------- 00095 00096 #define RSS_TYPE 1 00097 #define OBB_TYPE 2 00098 00099 #define PQP_BV_TYPE RSS_TYPE | OBB_TYPE 00100 00101 #define obb_disjoint PQP_obb_disjoint 00102 #define project6 PQP_obb_project6 00103 #endif