VR-Forces 4.2 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
include
bhavePathDataGen
pathFeatureConverter.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2011 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
6
#pragma once
7
8
#include <deque>
9
#include <
bhavePathDataGen/baseFeatureConverter.h
>
10
#include <
terrainInterface/terrainProcessPolygonsBox.h
>
11
12
#include <
features/pathFeature.h
>
13
#include <
features/featureGeometry.h
>
14
15
class
DtTerrainInterface
;
16
17
namespace
BHAVE
18
{
22
struct
DtSegmentStruct
23
{
24
DtPoint
leftOffset
;
25
DtPoint
rightOffset
;
26
double
halfWidth
;
27
unsigned
int
segmentId
;
28
unsigned
int
firstNodeId
;
29
unsigned
int
secondNodeId
;
30
MAKVRinTerra::DtPathFeature::CPtr
feature
;
31
32
DtPoint
leftFirstBP
;
33
DtPoint
rightFirstBP
;
34
DtPoint
leftSecondBP
;
35
DtPoint
rightSecondBP
;
36
37
DtPoint
leftEnd
;
38
DtPoint
rightEnd
;
39
40
DtSegmentStruct
(
MAKVRinTerra::DtPathFeature::CPtr
f,
const
DtPoint& leftPoint,
const
DtPoint& rightPoint)
41
{
42
feature
= f;
43
leftEnd
= leftPoint;
44
rightEnd
= rightPoint;
45
}
46
47
DtPoint
endPoint
(
int
zeroOrOne)
const
48
{
49
if
(zeroOrOne)
50
{
51
return
rightEnd
;
52
}
53
else
54
{
55
return
leftEnd
;
56
}
57
}
58
};
59
63
struct
DtSegmentNodeStruct
64
{
65
public
:
66
DtPoint
location
;
67
std::map<unsigned int,int>
segmentEnds
;
68
unsigned
int
nodeId
;
69
std::deque<DtPoint>
boundingPoints
;
70
71
DtSegmentNodeStruct
(
const
DtPoint&
point
)
72
{
73
location
=
point
;
74
}
75
76
bool
operator<
(
const
DtSegmentNodeStruct
& right)
const
77
{
78
if
(
location
.x() != right.
location
.x())
79
{
80
return
(
location
.x() < right.
location
.x());
81
}
82
if
(
location
.y() != right.
location
.y())
83
{
84
return
(
location
.y() < right.
location
.y());
85
}
86
if
(
location
.z() != right.
location
.z())
87
{
88
return
(
location
.z() < right.
location
.z());
89
}
90
return
false
;
91
}
92
93
bool
operator==
(
const
DtSegmentNodeStruct
& other)
const
94
{
95
return
(
location
== other.
location
);
96
}
97
98
bool
operator!=
(
const
DtSegmentNodeStruct
& other)
const
99
{
100
return
(
location
== other.
location
);
101
}
102
};
103
104
class
DtPathFeatureConverter
:
public
DtBaseFeatureConverter
105
{
106
public
:
107
108
DtPathFeatureConverter
(
DtTerrainInterface
*
terrainInterface
,
109
const
std::string&
featureType
,
110
unsigned
int
terrainType
,
111
bool
isGeocentric
=
false
);
112
113
virtual
~DtPathFeatureConverter
();
114
122
virtual
void
init
(
DtTerrainProcessPolygonsBox
& box);
123
124
virtual
bool
processAllBoundingPolygons
(
DtProcessBoundingPolygonCallbackFcn
func,
void
* usr);
125
128
virtual
void
operator()
(
const
MAKVRinTerra::DtPathFeature
& feature);
129
130
protected
:
131
147
//
150
virtual
bool
calcSegmentPoints
(
DtSegmentStruct
& segment);
151
158
virtual
bool
calcSlopeOfLine
(
const
DtPoint& startPoint,
const
DtPoint& endPoint,
double
&
slope
)
const
;
159
167
//
175
//
176
//
183
virtual
bool
calcIntersectionOfTwoArbSegs
(
const
DtPoint& segOneA,
const
DtPoint& segOneB,
184
const
DtPoint& segTwoA,
const
DtPoint& segTwoB, DtPoint& result)
const
;
185
189
//
194
//
197
//
201
virtual
void
calcEndNodePoints
(
DtSegmentNodeStruct
& node,
unsigned
int
segmentId,
int
segmentEnd);
202
211
//
219
//
225
virtual
void
calcTopNodePoints
(
DtSegmentNodeStruct
& node,
unsigned
int
segmentOneId,
226
int
segmentOneEnd,
unsigned
int
segmentTwoId,
int
segmentTwoEnd);
227
231
virtual
void
calcNodeBoundingPoints
();
232
240
virtual
unsigned
int
addNode
(
const
DtPoint&
point
,
unsigned
int
segmentId,
int
endpoint);
241
246
//
251
//
252
//
257
virtual
double
determineAngle
(
const
DtPoint& centerPoint,
const
DtPoint& point,
bool
degrees =
false
)
const
;
258
260
std::map<DtSegmentNodeStruct, unsigned int>
myNodeHistory
;
261
std::deque<DtSegmentNodeStruct>
myNodes
;
262
std::deque<DtSegmentStruct>
mySegments
;
263
};
264
}
Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)