00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef WM4INTRSEGMENT3TRIANGLE3_H
00017 #define WM4INTRSEGMENT3TRIANGLE3_H
00018
00019 #include "Wm4FoundationLIB.h"
00020 #include "Wm4Intersector.h"
00021 #include "Wm4Segment3.h"
00022 #include "Wm4Triangle3.h"
00023
00024 namespace Wm4
00025 {
00026
00027 template <class Real>
00028 class WM4_FOUNDATION_ITEM IntrSegment3Triangle3
00029 : public Intersector<Real,Vector3<Real> >
00030 {
00031 public:
00032 IntrSegment3Triangle3 (const Segment3<Real>& rkSegment,
00033 const Triangle3<Real>& rkTriangle);
00034
00035
00036 const Segment3<Real>& GetSegment () const;
00037 const Triangle3<Real>& GetTriangle () const;
00038
00039
00040 virtual bool Test ();
00041
00042
00043
00044 virtual bool Find ();
00045 Real GetSegmentT () const;
00046 Real GetTriB0 () const;
00047 Real GetTriB1 () const;
00048 Real GetTriB2 () const;
00049
00050
00051 virtual bool Test (Real fTMax, const Vector3<Real>& rkVelocity0,
00052 const Vector3<Real>& rkVelocity1);
00053
00054
00055
00056
00057
00058
00059 virtual bool Find (Real fTMax, const Vector3<Real>& rkVelocity0,
00060 const Vector3<Real>& rkVelocity1);
00061
00062 int GetQuantity () const;
00063 const Vector3<Real>& GetPoint (int i) const;
00064
00065 private:
00066 using Intersector<Real,Vector3<Real> >::IT_EMPTY;
00067 using Intersector<Real,Vector3<Real> >::IT_POINT;
00068 using Intersector<Real,Vector3<Real> >::IT_SEGMENT;
00069 using Intersector<Real,Vector3<Real> >::m_fContactTime;
00070 using Intersector<Real,Vector3<Real> >::m_iIntersectionType;
00071
00072
00073 const Segment3<Real>* m_pkSegment;
00074 const Triangle3<Real>* m_pkTriangle;
00075
00076
00077 Real m_fSegmentT, m_fTriB0, m_fTriB1, m_fTriB2;
00078
00079
00080 int m_iQuantity;
00081 Vector3<Real> m_akPoint[2];
00082 };
00083
00084 typedef IntrSegment3Triangle3<float> IntrSegment3Triangle3f;
00085 typedef IntrSegment3Triangle3<double> IntrSegment3Triangle3d;
00086
00087 }
00088
00089 #endif