All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RouteViewGeometryFactoryCurveHelpers.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "VectorMath.h"
7 #include "Routes.h"
8 #include <vector>
9 
10 namespace Eegeo
11 {
12  namespace Routes
13  {
14  namespace View
15  {
16  const float EpsilonMeters = 0.0009f;
17 
18  struct CurveData
19  {
20  v2 originalPrev;
21  v2 originalCurve;
22  v2 originalNext;
23 
24  // or just store the 'length' values of these points projected onto ba, bc
25  v2 intersectionInner;
26  v2 intersectionOuter;
27  v2 intersectionPrevOuter;
28  v2 intersectionNextOuter;
29 
30  u16 firstIndex;
31  u16 lastIndexExclusive;
32 
33  bool swapped;
34  };
35 
36 
37  bool IsCoincidentModuloZ(const v2& p, const v2& q, const float epsilon);
38 
39  void CalculateVertexIndicesForCurveInsertion(
40  const std::vector<RouteVert>& verts,
41  float curveAngleThresholdDot,
42  std::vector<size_t>& outIndices);
43 
44  void CalculateInteriorCurveVerticesAndAddToCollection(
45  const RouteVert& inputA,
46  const RouteVert& inputB,
47  const RouteVert& inputC,
48  int bezierSegmentCount,
49  std::vector<CurveData>& addToCurveDatas,
50  std::vector<RouteVert>& addToVertices,
51  std::vector<u16>& addToIndices);
52 
53  void CorrectVerticesThatIntersectWithCurves(
54  const std::vector<CurveData>& curveDatas,
55  std::vector<RouteVert>& verts);
56  }
57  }
58 }
59 
60