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 WM4DISTVECTOR3SEGMENT3_H 00018 #define WM4DISTVECTOR3SEGMENT3_H 00019 00020 #include "Wm4FoundationLIB.h" 00021 #include "Wm4Distance.h" 00022 #include "Wm4Segment3.h" 00023 00024 namespace Wm4 00025 { 00026 00027 template <class Real> 00028 class WM4_FOUNDATION_ITEM DistVector3Segment3 00029 : public Distance<Real,Vector3<Real> > 00030 { 00031 public: 00032 DistVector3Segment3 (const Vector3<Real>& rkVector, 00033 const Segment3<Real>& rkSegment); 00034 00035 // object access 00036 const Vector3<Real>& GetVector () const; 00037 const Segment3<Real>& GetSegment () 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 line point. 00050 Real GetSegmentParameter () 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 Segment3<Real>& m_rkSegment; 00058 00059 // Information about the closest segment point. 00060 Real m_fSegmentParameter; // closest1 = seg.origin+param*seg.direction 00061 }; 00062 00063 typedef DistVector3Segment3<float> DistVector3Segment3f; 00064 typedef DistVector3Segment3<double> DistVector3Segment3d; 00065 00066 } 00067 00068 #endif