Wm4IntrSegment3Triangle3.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-2008
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 //
00014 // Version: 4.0.3 (2008/10/11)
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     // Object access.
00036     const Segment3<Real>& GetSegment () const;
00037     const Triangle3<Real>& GetTriangle () const;
00038 
00039     // Test-intersection query.
00040     virtual bool Test ();
00041 
00042     // Find-intersection query.  The point of intersection is
00043     //   P = origin + t*direction = b0*V0 + b1*V1 + b2*V2
00044     virtual bool Find ();
00045     Real GetSegmentT () const;
00046     Real GetTriB0 () const;
00047     Real GetTriB1 () const;
00048     Real GetTriB2 () const;
00049 
00050     // Dynamic test-intersection query.
00051     virtual bool Test (Real fTMax, const Vector3<Real>& rkVelocity0,
00052         const Vector3<Real>& rkVelocity1);
00053 
00054     // Dynamic find-intersection query.  The first point of contact is
00055     // accessed by GetPoint(0), when there is a single contact, or by
00056     // GetPoint(0) and GetPoint(1), when the contact is a segment, in which
00057     // case the fetched points are the segment endpoints.  The first time of
00058     // contact is accessed by GetContactTime().
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     // The objects to intersect.
00073     const Segment3<Real>* m_pkSegment;
00074     const Triangle3<Real>* m_pkTriangle;
00075 
00076     // Information about the stationary intersection set.
00077     Real m_fSegmentT, m_fTriB0, m_fTriB1, m_fTriB2;
00078 
00079     // Information about the dynamic intersection set.
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

Generated on Fri Feb 13 13:58:10 2009 for meshmorph by  doxygen 1.5.1