Wm4IntrLine3Box3.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 WM4INTRLINE3BOX3_H
00018 #define WM4INTRLINE3BOX3_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Intersector.h"
00022 #include "Wm4Line3.h"
00023 #include "Wm4Box3.h"
00024 
00025 namespace Wm4
00026 {
00027 
00028 template <class Real>
00029 class WM4_FOUNDATION_ITEM IntrLine3Box3
00030     : public Intersector<Real,Vector3<Real> >
00031 {
00032 public:
00033     IntrLine3Box3 (const Line3<Real>& rkLine, const Box3<Real>& rkBox);
00034 
00035     // object access
00036     const Line3<Real>& GetLine () const;
00037     const Box3<Real>& GetBox () const;
00038 
00039     // static intersection queries
00040     virtual bool Test ();
00041     virtual bool Find ();
00042 
00043     // the intersection set
00044     int GetQuantity () const;
00045     const Vector3<Real>& GetPoint (int i) const;
00046 
00047 private:
00048     using Intersector<Real,Vector3<Real> >::IT_EMPTY;
00049     using Intersector<Real,Vector3<Real> >::IT_POINT;
00050     using Intersector<Real,Vector3<Real> >::IT_SEGMENT;
00051     using Intersector<Real,Vector3<Real> >::m_iIntersectionType;
00052 
00053     static bool Clip (Real fDenom, Real fNumer, Real& rfT0, Real& rfT1);
00054 
00055     // the objects to intersect
00056     const Line3<Real>& m_rkLine;
00057     const Box3<Real>& m_rkBox;
00058 
00059     // information about the intersection set
00060     int m_iQuantity;
00061     Vector3<Real> m_akPoint[2];
00062 
00063 // internal use (shared by IntrRay3Box3 and IntrSegment3Box3)
00064 public:
00065     static bool DoClipping (Real fT0, Real fT1, const Vector3<Real>& rkOrigin,
00066         const Vector3<Real>& rkDirection, const Box3<Real>& rkBox,
00067         bool bSolid, int& riQuantity, Vector3<Real> akPoint[2],
00068         int& riIntrType);
00069 };
00070 
00071 typedef IntrLine3Box3<float> IntrLine3Box3f;
00072 typedef IntrLine3Box3<double> IntrLine3Box3d;
00073 
00074 }
00075 
00076 #endif

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