Wm4Query2.h

Go to the documentation of this file.
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 WM4QUERY2_H
00018 #define WM4QUERY2_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Query.h"
00022 #include "Wm4Vector2.h"
00023 
00024 namespace Wm4
00025 {
00026 
00027 template <class Real>
00028 class Query2 : public Query
00029 {
00030 public:
00031     // The base class handles floating-point queries.
00032     Query2 (int iVQuantity, const Vector2<Real>* akVertex);
00033     virtual ~Query2 ();
00034 
00035     // run-time type information
00036     virtual Query::Type GetType () const;
00037 
00038     // member access
00039     int GetQuantity () const;
00040     const Vector2<Real>* GetVertices () const;
00041 
00042     // Queries about the relation of a point to various geometric objects.
00043 
00044     // returns
00045     //   +1, on right of line
00046     //   -1, on left of line
00047     //    0, on the line
00048     virtual int ToLine (int i, int iV0, int iV1) const;
00049     virtual int ToLine (const Vector2<Real>& rkP, int iV0, int iV1) const;
00050 
00051     // returns
00052     //   +1, outside triangle
00053     //   -1, inside triangle
00054     //    0, on triangle
00055     virtual int ToTriangle (int i, int iV0, int iV1, int iV2) const;
00056     virtual int ToTriangle (const Vector2<Real>& rkP, int iV0, int iV1,
00057         int iV2) const;
00058 
00059     // returns
00060     //   +1, outside circumcircle of triangle
00061     //   -1, inside circumcircle of triangle
00062     //    0, on circumcircle of triangle
00063     virtual int ToCircumcircle (int i, int iV0, int iV1, int iV2) const;
00064     virtual int ToCircumcircle (const Vector2<Real>& rkP, int iV0, int iV1,
00065         int iV2) const;
00066 
00067 protected:
00068     // input points
00069     int m_iVQuantity;
00070     const Vector2<Real>* m_akVertex;
00071 
00072     static Real Dot (Real fX0, Real fY0, Real fX1, Real fY1);
00073 
00074     static Real Det2 (Real fX0, Real fY0, Real fX1, Real fY1);
00075 
00076     static Real Det3 (Real iX0, Real iY0, Real iZ0, Real iX1, Real iY1,
00077         Real iZ1, Real iX2, Real iY2, Real iZ2);
00078 };
00079 
00080 }
00081 
00082 #include "Wm4Query2.inl"
00083 
00084 namespace Wm4
00085 {
00086 typedef Query2<float> Query2f;
00087 typedef Query2<double> Query2d;
00088 }
00089 
00090 #endif

Generated on Wed Nov 23 19:01:07 2011 for FreeCAD by  doxygen 1.6.1