Wm4Query3.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 WM4QUERY3_H
00018 #define WM4QUERY3_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Query.h"
00022 #include "Wm4Vector3.h"
00023 
00024 namespace Wm4
00025 {
00026 
00027 template <class Real>
00028 class Query3 : public Query
00029 {
00030 public:
00031     // The base class handles floating-point queries.
00032     Query3 (int iVQuantity, const Vector3<Real>* akVertex);
00033     virtual ~Query3 ();
00034 
00035     // run-time type information
00036     virtual Query::Type GetType () const;
00037 
00038     // member access
00039     int GetQuantity () const;
00040     const Vector3<Real>* GetVertices () const;
00041 
00042     // Queries about the relation of a point to various geometric objects.
00043 
00044     // returns
00045     //   +1, on positive side of plane
00046     //   -1, on negative side of line
00047     //    0, on the plane
00048     virtual int ToPlane (int i, int iV0, int iV1, int iV2) const;
00049     virtual int ToPlane (const Vector3<Real>& rkP, int iV0, int iV1, int iV2)
00050         const;
00051 
00052     // returns
00053     //   +1, outside tetrahedron
00054     //   -1, inside tetrahedron
00055     //    0, on tetrahedron
00056     virtual int ToTetrahedron (int i, int iV0, int iV1, int iV2, int iV3)
00057         const;
00058     virtual int ToTetrahedron (const Vector3<Real>& rkP, int iV0, int iV1,
00059         int iV2, int iV3) const;
00060 
00061     // returns
00062     //   +1, outside circumsphere of tetrahedron
00063     //   -1, inside circumsphere of tetrahedron
00064     //    0, on circumsphere of tetrahedron
00065     virtual int ToCircumsphere (int i, int iV0, int iV1, int iV2, int iV3)
00066         const;
00067     virtual int ToCircumsphere (const Vector3<Real>& rkP, int iV0, int iV1,
00068         int iV2, int iV3) const;
00069 
00070 protected:
00071     // input points
00072     int m_iVQuantity;
00073     const Vector3<Real>* m_akVertex;
00074 
00075     static Real Dot (Real fX0, Real fY0, Real fZ0, Real fX1, Real fY1,
00076         Real fZ1);
00077 
00078     static Real Det3 (Real fX0, Real fY0, Real fZ0, Real fX1, Real fY1,
00079         Real fZ1, Real fX2, Real fY2, Real fZ2);
00080 
00081     static Real Det4 (Real fX0, Real fY0, Real fZ0, Real fW0, Real fX1,
00082         Real fY1, Real fZ1, Real fW1, Real fX2, Real fY2, Real fZ2, Real fW2,
00083         Real fX3, Real fY3, Real fZ3, Real fW3);
00084 };
00085 
00086 }
00087 
00088 #include "Wm4Query3.inl"
00089 
00090 namespace Wm4
00091 {
00092 typedef Query3<float> Query3f;
00093 typedef Query3<double> Query3d;
00094 
00095 }
00096 
00097 #endif

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