All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RouteClippedLineSegment.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Routes.h"
6 #include "MortonKey.h"
7 #include "ClippedRouteSection.h"
8 #include "MathFunc.h"
9 #include "VectorMath.h"
10 
11 #include <vector>
12 
13 namespace Eegeo
14 {
15  namespace Routes
16  {
17  namespace Clipping
18  {
20  {
22  int startVertexIndex,
23  double t0,
24  double t1)
25  : m_key(key)
26  , m_startVertexIndex(startVertexIndex)
27  , m_t0(t0)
28  , m_t1(t1)
29  {
30  }
31 
32  inline int StartVertexIndex() const { return m_startVertexIndex; }
33  inline double LerpParam(double s) const { return Math::Lerp(m_t0, m_t1, s); }
34  inline const Streaming::MortonKey& Key() const { return m_key; }
35 
36  inline dv3 Point0(const std::vector<dv3>& routePointsEcef) const
37  {
38  return dv3::Lerp(routePointsEcef.at(m_startVertexIndex), routePointsEcef.at(m_startVertexIndex + 1), m_t0);
39  }
40 
41  inline dv3 Point1(const std::vector<dv3>& routePointsEcef) const
42  {
43  return dv3::Lerp(routePointsEcef.at(m_startVertexIndex), routePointsEcef.at(m_startVertexIndex + 1), m_t1);
44  }
45 
46  inline ClippedRouteSection ToClippedRouteSection() const
47  {
48  ClippedRouteSection section(m_key);
49  section.Start = ClippedRouteVertex(m_startVertexIndex, m_t0);
50  section.End = ClippedRouteVertex(m_startVertexIndex, m_t1);
51  return section;
52  }
53  private:
55  int m_startVertexIndex;
56  double m_t0;
57  double m_t1;
58  };
59  }
60  }
61 }