VR-Forces 4.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
include
geometry
chordUtilities.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2005 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
/******************************************************************************
6
** $RCSfile: chordUtilities.h,v $ $Revision: 1.6 $ $State: Exp $
7
******************************************************************************/
8
#ifndef chordUtilities_H_
9
#define chordUtilities_H_
10
11
//
12
// \file chordUtilities.h
13
// \brief Contains utility functions for chords, such as intersection, distance from,
14
// and the closest point to.
15
//
16
17
#include "
geometry/geometryDefines.h
"
18
#include "
geometry/point.h
"
19
20
class
DtChord
;
21
22
23
// The DtChordIntersectionResult enum contains the different possible intersection
24
// values between two chords.
25
typedef
enum
26
{
27
DtNonParallelNonIntersecting
= 0,
28
DtNonParallelIntersecting
,
29
DtParallelOverlapping
,
30
DtParallelNonOverlapping
,
31
DtSameChord
32
}
DtChordIntersectionResult
;
33
34
35
// A helper function designed to turn the intersection result above into a
36
// simple bool when a simple yes/no intersection result is desired.
37
DT_DLL_geometry
bool
DtChordsIntersect
(
DtChordIntersectionResult
intersectionResult);
38
39
// If two segments have an angle between them less than this value
40
// they are treated as parallel.
41
DT_DLL_geometry
double
theParallelAngle
();
42
43
44
// Calculate if the projections onto the x-y plane of another segment
45
// and this segment intersect.
46
DT_DLL_geometry
DtChordIntersectionResult
DtIntersectInXY
(
const
DtChord
& chord1,
47
const
DtChord
& chord2);
48
DT_DLL_geometry
DtChordIntersectionResult
DtIntersectInXY
(
const
DtPoint
& chord1EndPoint0,
49
const
DtPoint
& chord1EndPoint1,
const
DtChord
& chord2);
50
DT_DLL_geometry
DtChordIntersectionResult
DtIntersectInXY
(
const
DtChord
& chord1,
51
const
DtPoint
& chord2EndPoint0,
const
DtPoint
& chord2EndPoint1);
52
DT_DLL_geometry
DtChordIntersectionResult
DtIntersectInXY
(
const
DtPoint
& chord1EndPoint0,
53
const
DtPoint
& chord1EndPoint1,
const
DtPoint
& chord2EndPoint0,
const
DtPoint
& chord2EndPoint1);
54
55
// Calculate if the projections onto the x-y plane of two chords, and see if the
56
// projections intersect. Calculate the closest point on each chord's
57
// projection to the other chord's projection. If the two chords intersect,
58
// then the closest point is the intersection point.
59
//
60
// \param distanceSquared The distance between the two chords squared,
61
// \param thisX/thisY hold the closest points on chord1
62
// \param otherX/otherY hold the closest point on chord2.
63
DT_DLL_geometry
DtChordIntersectionResult
DtIntersectInXY
(
const
DtChord
& chord1,
64
const
DtChord
& chord2,
double
& distanceSquared,
double
& chord1X,
double
& chord1Y,
65
double
& chord2X,
double
& chord2Y);
66
67
68
DT_DLL_geometry
double
DtPointChordDistanceInXY
(
double
pointX,
double
pointY,
69
double
end0X,
double
end0Y,
70
double
end1X,
double
end1Y);
71
72
DT_DLL_geometry
double
DtPointChordDistanceInXY
(
double
pointX,
double
pointY,
73
double
end0X,
double
end0Y,
74
double
end1X,
double
end1Y,
75
double
& outX,
double
& outY);
76
77
78
DT_DLL_geometry
void
DtClosestPoint
(
const
DtChord
& chord,
const
DtPoint
& pointOfInterest,
79
DtPoint
& closestPoint,
double
&
distance
);
80
81
DT_DLL_geometry
void
DtClosestPoint
(
const
DtPoint
& chordEndPoint0,
const
DtPoint
& chordEndPoint1,
82
const
DtPoint
& pointOfInterest,
DtPoint
& closestPoint,
double
&
distance
);
83
84
85
DT_DLL_geometry
void
DtClosestPointInXY
(
const
DtChord
& chord,
const
DtPoint
& pointOfInterest,
86
DtPoint
& closestPnt,
double
&
distance
);
87
88
DT_DLL_geometry
void
DtClosestPointInXY
(
const
DtPoint
& chordEndPoint0,
const
DtPoint
& chordEndPoint1,
89
const
DtPoint
& pointOfInterest,
DtPoint
& closestPnt,
double
&
distance
);
90
91
// Finds the closest approach between the two specified chords in 3D.
92
// The points on each chord are passed back in chord1Point and chord2Point.
93
// The time value (0 - 1.0) along each chord of the points are passed back
94
// in chord1T and chord2T.
95
// \return The square of the distance at the closest approach.
96
DT_DLL_geometry
double
DtClosestApproachChordToChord
(
const
DtChord
& chord1,
97
const
DtChord
& chord2,
98
double
& chord1T,
99
double
& chord2T,
100
DtPoint
& chord1Point,
101
DtPoint
& chord2Point);
102
103
#endif
Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)