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 WM4QUERY2FILTERED_H 00018 #define WM4QUERY2FILTERED_H 00019 00020 #include "Wm4FoundationLIB.h" 00021 #include "Wm4Query2TRational.h" 00022 #include "Wm4Vector2.h" 00023 00024 namespace Wm4 00025 { 00026 00027 template <class Real> 00028 class Query2Filtered : public Query2<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 Query2. The uncertainty of 1 causes the class to 00039 // behave as if it were Query2TRational. 00040 Query2Filtered (int iVQuantity, const Vector2<Real>* akVertex, 00041 Real fUncertainty); 00042 virtual ~Query2Filtered (); 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 ToLine (const Vector2<Real>& rkP, int iV0, int iV1) const; 00050 00051 virtual int ToCircumcircle (const Vector2<Real>& rkP, int iV0, int iV1, 00052 int iV2) const; 00053 00054 private: 00055 using Query2<Real>::m_akVertex; 00056 00057 Query2TRational<Real> m_kRQuery; 00058 Real m_fUncertainty; 00059 }; 00060 00061 } 00062 00063 #include "Wm4Query2Filtered.inl" 00064 00065 namespace Wm4 00066 { 00067 typedef Query2Filtered<float> Query2Filteredf; 00068 typedef Query2Filtered<double> Query2Filteredd; 00069 00070 } 00071 00072 #endif