00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef WM4QUERY3TRATIONAL_H
00018 #define WM4QUERY3TRATIONAL_H
00019
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Query3.h"
00022 #include "Wm4RVector3.h"
00023
00024 namespace Wm4
00025 {
00026
00027 template <class Real>
00028 class Query3TRational : public Query3<Real>
00029 {
00030 public:
00031
00032
00033 Query3TRational (int iVQuantity, const Vector3<Real>* akVertex);
00034 virtual ~Query3TRational ();
00035
00036
00037 virtual Query::Type GetType () const;
00038
00039
00040
00041 virtual int ToPlane (int i, int iV0, int iV1, int iV2) const;
00042 virtual int ToPlane (const Vector3<Real>& rkP, int iV0, int iV1, int iV2)
00043 const;
00044
00045 virtual int ToTetrahedron (int i, int iV0, int iV1, int iV2, int iV3)
00046 const;
00047 virtual int ToTetrahedron (const Vector3<Real>& rkP, int iV0, int iV1,
00048 int iV2, int iV3) const;
00049
00050 virtual int ToCircumsphere (int i, int iV0, int iV1, int iV2, int iV3)
00051 const;
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_iVQuantity;
00057 using Query3<Real>::m_akVertex;
00058
00059
00060
00061
00062 typedef TRational<8*sizeof(Real)> Rational;
00063 typedef RVector3<8*sizeof(Real)> RVector;
00064 mutable RVector* m_akRVertex;
00065 mutable bool* m_abEvaluated;
00066
00067 void Convert (int iQuantity, int* aiIndex) const;
00068
00069 int ToPlane (const RVector& rkRP, int iV0, int iV1, int iV2) const;
00070 int ToTetrahedron (const RVector& rkRP, int iV0, int iV1, int iV2,
00071 int iV3) const;
00072 int ToCircumsphere (const RVector& rkRP, int iV0, int iV1, int iV2,
00073 int iV3) const;
00074
00075 static Rational Dot (Rational& rkX0, Rational& rkY0, Rational& rkZ0,
00076 Rational& rkX1, Rational& rkY1, Rational& rkZ1);
00077
00078 static Rational Det3 (Rational& rkX0, Rational& rkY0, Rational& rkZ0,
00079 Rational& rkX1, Rational& rkY1, Rational& rkZ1, Rational& rkX2,
00080 Rational& rkY2, Rational& rkZ2);
00081
00082 static Rational Det4 (Rational& rkX0, Rational& rkY0, Rational& rkZ0,
00083 Rational& rkW0, Rational& rkX1, Rational& rkY1, Rational& rkZ1,
00084 Rational& rkW1, Rational& rkX2, Rational& rkY2, Rational& rkZ2,
00085 Rational& rkW2, Rational& rkX3, Rational& rkY3, Rational& rkZ3,
00086 Rational& rkW3);
00087 };
00088
00089 }
00090
00091 #include "Wm4Query3TRational.inl"
00092
00093 namespace Wm4
00094 {
00095 typedef Query3TRational<float> Query3TRationalf;
00096 typedef Query3TRational<double> Query3TRationald;
00097
00098 }
00099
00100 #endif