1
// Wild Magic Source Code
3
// http://www.geometrictools.com
4
// Copyright (c) 1998-2007
6
// This library is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License as published by
8
// the Free Software Foundation; either version 2.1 of the License, or (at
9
// your option) any later version. The license is available for reading at
10
// either of the locations:
11
// http://www.gnu.org/copyleft/lgpl.html
12
// http://www.geometrictools.com/License/WildMagicLicense.pdf
13
// The license applies to versions 0 through 4 of Wild Magic.
15
// Version: 4.0.0 (2006/06/28)
17
#ifndef WM4DISTSEGMENT3TRIANGLE3_H
18
#define WM4DISTSEGMENT3TRIANGLE3_H
20
#include "Wm4FoundationLIB.h"
21
#include "Wm4Distance.h"
22
#include "Wm4Segment3.h"
23
#include "Wm4Triangle3.h"
29
class WM4_FOUNDATION_ITEM DistSegment3Triangle3
30
: public Distance<Real,Vector3<Real> >
33
DistSegment3Triangle3 (const Segment3<Real>& rkSegment,
34
const Triangle3<Real>& rkTriangle);
37
const Segment3<Real>& GetSegment () const;
38
const Triangle3<Real>& GetTriangle () const;
40
// static distance queries
42
virtual Real GetSquared ();
44
// function calculations for dynamic distance queries
45
virtual Real Get (Real fT, const Vector3<Real>& rkVelocity0,
46
const Vector3<Real>& rkVelocity1);
47
virtual Real GetSquared (Real fT, const Vector3<Real>& rkVelocity0,
48
const Vector3<Real>& rkVelocity1);
50
// Information about the closest points.
51
Real GetSegmentParameter () const;
52
Real GetTriangleBary (int i) const;
55
using Distance<Real,Vector3<Real> >::m_kClosestPoint0;
56
using Distance<Real,Vector3<Real> >::m_kClosestPoint1;
58
const Segment3<Real>& m_rkSegment;
59
const Triangle3<Real>& m_rkTriangle;
61
// Information about the closest points.
62
Real m_fSegmentParameter; // closest0 = seg.origin+param*seg.direction
63
Real m_afTriangleBary[3]; // closest1 = sum_{i=0}^2 bary[i]*tri.vertex[i]
66
typedef DistSegment3Triangle3<float> DistSegment3Triangle3f;
67
typedef DistSegment3Triangle3<double> DistSegment3Triangle3d;