Wm4DistVector3Triangle3.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 WM4DISTVECTOR3TRIANGLE3_H
00018 #define WM4DISTVECTOR3TRIANGLE3_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Distance.h"
00022 #include "Wm4Triangle3.h"
00023 
00024 namespace Wm4
00025 {
00026 
00027 template <class Real>
00028 class WM4_FOUNDATION_ITEM DistVector3Triangle3
00029     : public Distance<Real,Vector3<Real> >
00030 {
00031 public:
00032     DistVector3Triangle3 (const Vector3<Real>& rkVector,
00033         const Triangle3<Real>& rkTriangle);
00034 
00035     // object access
00036     const Vector3<Real>& GetVector () const;
00037     const Triangle3<Real>& GetTriangle () const;
00038 
00039     // static distance queries
00040     virtual Real Get ();
00041     virtual Real GetSquared ();
00042 
00043     // function calculations for dynamic distance queries
00044     virtual Real Get (Real fT, const Vector3<Real>& rkVelocity0,
00045         const Vector3<Real>& rkVelocity1);
00046     virtual Real GetSquared (Real fT, const Vector3<Real>& rkVelocity0,
00047         const Vector3<Real>& rkVelocity1);
00048 
00049     // Information about the closest triangle point.
00050     Real GetTriangleBary (int i) const;
00051 
00052 private:
00053     using Distance<Real,Vector3<Real> >::m_kClosestPoint0;
00054     using Distance<Real,Vector3<Real> >::m_kClosestPoint1;
00055 
00056     const Vector3<Real>& m_rkVector;
00057     const Triangle3<Real>& m_rkTriangle;
00058 
00059     // Information about the closest triangle point.
00060     Real m_afTriangleBary[3];  // closest1 = sum_{i=0}^2 bary[i]*tri.vertex[i]
00061 };
00062 
00063 typedef DistVector3Triangle3<float> DistVector3Triangle3f;
00064 typedef DistVector3Triangle3<double> DistVector3Triangle3d;
00065 
00066 }
00067 
00068 #endif

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