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 WM4DISTSEGMENT3SEGMENT3_H 00018 #define WM4DISTSEGMENT3SEGMENT3_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 DistSegment3Segment3 00029 : public Distance<Real,Vector3<Real> > 00030 { 00031 public: 00032 DistSegment3Segment3 (const Segment3<Real>& rkSegment0, 00033 const Segment3<Real>& rkSegment1); 00034 00035 // object access 00036 const Segment3<Real>& GetSegment0 () const; 00037 const Segment3<Real>& GetSegment1 () 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 points. 00050 Real GetSegment0Parameter () const; 00051 Real GetSegment1Parameter () const; 00052 00053 private: 00054 using Distance<Real,Vector3<Real> >::m_kClosestPoint0; 00055 using Distance<Real,Vector3<Real> >::m_kClosestPoint1; 00056 00057 const Segment3<Real>& m_rkSegment0; 00058 const Segment3<Real>& m_rkSegment1; 00059 00060 // Information about the closest points. 00061 Real m_fSegment0Parameter; // closest0 = seg0.origin+param*seg0.direction 00062 Real m_fSegment1Parameter; // closest1 = seg1.origin+param*seg1.direction 00063 }; 00064 00065 typedef DistSegment3Segment3<float> DistSegment3Segment3f; 00066 typedef DistSegment3Segment3<double> DistSegment3Segment3d; 00067 00068 } 00069 00070 #endif