Wm4Intersector.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 WM4INTERSECTOR_H
00018 #define WM4INTERSECTOR_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4LinComp.h"
00022 #include "Wm4Vector2.h"
00023 #include "Wm4Vector3.h"
00024 
00025 namespace Wm4
00026 {
00027 
00028 template <class Real, class TVector>
00029 class WM4_FOUNDATION_ITEM Intersector
00030 {
00031 public:
00032     // abstract base class
00033     virtual ~Intersector ();
00034 
00035     // Static intersection queries.  The default implementations return
00036     // 'false'.  The Find query produces a set of intersection.  The derived
00037     // class is responsible for providing access to that set, since the nature
00038     // of the set is dependent on the object types.
00039     virtual bool Test ();
00040     virtual bool Find ();
00041 
00042     // Dynamic intersection queries.  The default implementations return
00043     // 'false'.  The Find query produces a set of first contact.  The derived
00044     // class is responsible for providing access to that set, since the nature
00045     // of the set is dependent on the object types.
00046     virtual bool Test (Real fTMax, const TVector& rkVelocity0,
00047         const TVector& rkVelocity1);
00048     virtual bool Find (Real fTMax, const TVector& rkVelocity0,
00049         const TVector& rkVelocity1);
00050 
00051     // The time at which two objects are in first contact for the dynamic
00052     // intersection queries.
00053     Real GetContactTime () const;
00054 
00055     // information about the intersection set
00056     enum
00057     {
00058         IT_EMPTY = LinComp<Real>::CT_EMPTY,
00059         IT_POINT = LinComp<Real>::CT_POINT,
00060         IT_SEGMENT = LinComp<Real>::CT_SEGMENT,
00061         IT_RAY = LinComp<Real>::CT_RAY,
00062         IT_LINE = LinComp<Real>::CT_LINE,
00063         IT_POLYGON,
00064         IT_PLANE,
00065         IT_POLYHEDRON,
00066         IT_OTHER
00067     };
00068     int GetIntersectionType () const;
00069 
00070 protected:
00071     Intersector ();
00072 
00073     Real m_fContactTime;
00074     int m_iIntersectionType;
00075 };
00076 
00077 typedef Intersector<float, Vector2<float> > Intersector2f;
00078 typedef Intersector<float, Vector3<float> > Intersector3f;
00079 typedef Intersector<double, Vector2<double> > Intersector2d;
00080 typedef Intersector<double, Vector3<double> > Intersector3d;
00081 
00082 }
00083 
00084 #endif

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