00001 // Wild Magic Source Code 00002 // David Eberly 00003 // http://www.geometrictools.com 00004 // Copyright (c) 1998-2007 00005 // 00006 // This library is free software; you can redistribute it and/or modify it 00007 // under the terms of the GNU Lesser General Public License as published by 00008 // the Free Software Foundation; either version 2.1 of the License, or (at 00009 // your option) any later version. The license is available for reading at 00010 // either of the locations: 00011 // http://www.gnu.org/copyleft/lgpl.html 00012 // http://www.geometrictools.com/License/WildMagicLicense.pdf 00013 // The license applies to versions 0 through 4 of Wild Magic. 00014 // 00015 // Version: 4.0.0 (2006/06/28) 00016 00017 #ifndef WM4QUERY3FILTERED_H 00018 #define WM4QUERY3FILTERED_H 00019 00020 #include "Wm4FoundationLIB.h" 00021 #include "Wm4Query3TRational.h" 00022 #include "Wm4Vector3.h" 00023 00024 namespace Wm4 00025 { 00026 00027 template <class Real> 00028 class Query3Filtered : public Query3<Real> 00029 { 00030 public: 00031 // The base class handles floating-point queries. Each query involves 00032 // comparing a determinant to zero. If the determinant is sufficiently 00033 // close to zero, numerical round-off errors may cause the determinant 00034 // sign to be misclassified. To avoid this, the query is repeated with 00035 // exact rational arithmetic. You specify the closeness to zero for the 00036 // switch to rational arithmetic via fUncertainty, a value in the 00037 // interval [0,1]. The uncertainty of 0 causes the class to behave 00038 // as if it were Query3. The uncertainty of 1 causes the class to 00039 // behave as if it were Query3TRational. 00040 Query3Filtered (int iVQuantity, const Vector3<Real>* akVertex, 00041 Real fUncertainty); 00042 virtual ~Query3Filtered (); 00043 00044 // run-time type information 00045 virtual Query::Type GetType () const; 00046 00047 // Queries about the relation of a point to various geometric objects. 00048 00049 virtual int ToPlane (const Vector3<Real>& rkP, int iV0, int iV1, int iV2) 00050 const; 00051 00052 virtual int ToCircumsphere (const Vector3<Real>& rkP, int iV0, int iV1, 00053 int iV2, int iV3) const; 00054 00055 private: 00056 using Query3<Real>::m_akVertex; 00057 00058 Query3TRational<Real> m_kRQuery; 00059 Real m_fUncertainty; 00060 }; 00061 00062 } 00063 00064 #include "Wm4Query3Filtered.inl" 00065 00066 namespace Wm4 00067 { 00068 typedef Query3Filtered<float> Query3Filteredf; 00069 typedef Query3Filtered<double> Query3Filteredd; 00070 00071 } 00072 00073 #endif