VR-Forces 4.1 Class Documentation
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>
11 
12 #include <features/pathFeature.h>
14 
15 class DtTerrainInterface;
16 
17 namespace BHAVE
18 {
23  {
26  double halfWidth;
27  unsigned int segmentId;
28  unsigned int firstNodeId;
29  unsigned int secondNodeId;
31 
36 
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 
64  {
65  public:
67  std::map<unsigned int,int> segmentEnds;
68  unsigned int nodeId;
69  std::deque<DtPoint> boundingPoints;
70 
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 
105  {
106  public:
107 
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 
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 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)