Wm4Intersector1.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 WM4INTERSECTOR1_H
00018 #define WM4INTERSECTOR1_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Math.h"
00022 
00023 namespace Wm4
00024 {
00025 
00026 template <class Real>
00027 class WM4_FOUNDATION_ITEM Intersector1
00028 {
00029 public:
00030     // A class for intersection of intervals [u0,u1] and [v0,v1].  The end
00031     // points must be ordered:  u0 <= u1 and v0 <= v1.  Values of MAX_REAL
00032     // and -MAX_REAL are allowed, and degenerate intervals are allowed:
00033     // u0 = u1 or v0 = v1.
00034     Intersector1 (Real fU0, Real fU1, Real fV0, Real fV1);
00035     Intersector1 (Real afU[2], Real afV[2]);
00036     virtual ~Intersector1 ();
00037 
00038     // object access
00039     Real GetU (int i) const;
00040     Real GetV (int i) const;
00041 
00042     // static intersection queries
00043     virtual bool Test ();
00044     virtual bool Find ();
00045 
00046     // Dynamic intersection queries.  The Find query produces a set of first
00047     // contact.
00048     virtual bool Test (Real fTMax, Real fSpeedU, Real fSpeedV);
00049     virtual bool Find (Real fTMax, Real fSpeedU, Real fSpeedV);
00050 
00051     // The time at which two intervals are in first/last contact for the
00052     // dynamic intersection queries.
00053     Real GetFirstTime () const;
00054     Real GetLastTime () const;
00055 
00056     // information about the intersection set
00057     int GetQuantity () const;
00058     Real GetOverlap (int i) const;
00059 
00060 protected:
00061     // the intervals to intersect
00062     Real m_afU[2], m_afV[2];
00063 
00064     // information about the intersection set
00065     Real m_fFirstTime, m_fLastTime;
00066     int m_iQuantity;
00067     Real m_afOverlap[2];
00068 };
00069 
00070 typedef Intersector1<float> Intersector1f;
00071 typedef Intersector1<double> Intersector1d;
00072 
00073 }
00074 
00075 #endif

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