VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
18 namespace BHAVE
19 {
24  {
25  DtPoint leftOffset;
26  DtPoint rightOffset;
27  double halfWidth;
28  unsigned int segmentId;
29  unsigned int firstNodeId;
30  unsigned int secondNodeId;
32 
33  DtPoint leftFirstBP;
34  DtPoint rightFirstBP;
35  DtPoint leftSecondBP;
36  DtPoint rightSecondBP;
37 
38  DtPoint leftEnd;
39  DtPoint rightEnd;
40 
41  DtSegmentStruct(MAKVRinTerra::DtPathFeature::CPtr f, const DtPoint& leftPoint, const DtPoint& rightPoint)
42  {
43  feature = f;
44  leftEnd = leftPoint;
45  rightEnd = rightPoint;
46  }
47 
48  DtPoint endPoint(int zeroOrOne) const
49  {
50  if (zeroOrOne)
51  {
52  return rightEnd;
53  }
54  else
55  {
56  return leftEnd;
57  }
58  }
59  };
60 
65  {
66  public:
67  DtPoint location;
68  std::map<unsigned int,int> segmentEnds;
69  unsigned int nodeId;
70  std::deque<DtPoint> boundingPoints;
71 
72  DtSegmentNodeStruct(const DtPoint& point)
73  {
74  location = point;
75  }
76 
77  bool operator< (const DtSegmentNodeStruct& right) const
78  {
79  if (location.x() != right.location.x())
80  {
81  return (location.x() < right.location.x());
82  }
83  if (location.y() != right.location.y())
84  {
85  return (location.y() < right.location.y());
86  }
87  if (location.z() != right.location.z())
88  {
89  return (location.z() < right.location.z());
90  }
91  return false;
92  }
93 
94  bool operator==(const DtSegmentNodeStruct& other) const
95  {
96  return (location == other.location);
97  }
98 
99  bool operator!=(const DtSegmentNodeStruct& other) const
100  {
101  return (location == other.location);
102  }
103  };
104 
106  {
107  public:
108 
109  DtPathFeatureConverter(DtTerrainInterface* terrainInterface,
110  const std::string& featureType,
111  unsigned int terrainType,
112  bool isGeocentric = false);
113 
114  virtual ~DtPathFeatureConverter();
115 
123  virtual void init(DtTerrainProcessPolygonsBox& box);
124 
125  virtual bool processAllBoundingPolygons(DtProcessBoundingPolygonCallbackFcn func, void* usr);
126 
129  virtual void operator()(const MAKVRinTerra::DtPathFeature& feature);
130 
131  protected:
132 
148  //
151  virtual bool calcSegmentPoints(DtSegmentStruct& segment);
152 
159  virtual bool calcSlopeOfLine(const DtPoint& startPoint, const DtPoint& endPoint, double& slope) const;
160 
168  //
176  //
177  //
184  virtual bool calcIntersectionOfTwoArbSegs(const DtPoint& segOneA, const DtPoint& segOneB,
185  const DtPoint& segTwoA, const DtPoint& segTwoB, DtPoint& result) const;
186 
190  //
195  //
198  //
202  virtual void calcEndNodePoints(DtSegmentNodeStruct& node, unsigned int segmentId, int segmentEnd);
203 
212  //
220  //
226  virtual void calcTopNodePoints(DtSegmentNodeStruct& node, unsigned int segmentOneId,
227  int segmentOneEnd, unsigned int segmentTwoId, int segmentTwoEnd);
228 
232  virtual void calcNodeBoundingPoints();
233 
241  virtual unsigned int addNode(const DtPoint& point, unsigned int segmentId, int endpoint);
242 
247  //
252  //
253  //
258  virtual double determineAngle(const DtPoint& centerPoint, const DtPoint& point, bool degrees = false) const;
259 
261  std::map<DtSegmentNodeStruct, unsigned int> myNodeHistory;
262  std::deque<DtSegmentNodeStruct> myNodes;
263  std::deque<DtSegmentStruct> mySegments;
264  };
265 }

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)