All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SpaceHelpers.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Space.h"
6 #include "VectorMathDecl.h"
7 #include "MortonKey.h"
8 #include "Geometry.h"
9 
10 #include <vector>
11 
12 namespace Eegeo
13 {
14  namespace Space
15  {
17  namespace SpaceHelpers
18  {
22  double GetAltitude(const dv3& pointEcef);
23 
24  v3 LocalEcefToZeroAltitudeLocalEcef(const v3& localEcef, const dv3& ecefCellOrigin);
25 
29  double PrincipleAngle(double angleRadians);
30 
34  double PrincipleAngleDegrees(double angleDegrees);
35 
40  double AngleDifference(double radiansA, double radiansB);
41 
46  double AngleDifferenceDegrees(double degreesA, double degreesB);
47 
48  double GreatCircleDistance(const LatLong& a, const LatLong& b, double sphereRadius);
49 
50  void LatLongBounds(const LatLong& p, double greatCircleRadius, double sphereRadius, LatLong& out_min, LatLong& out_max);
51 
52  void LatLongBoundsFromPoints(const std::vector<LatLong>& points, LatLong& out_southwest, LatLong& out_northeast);
53 
54  void InflatedLatLongBounds(
55  const LatLong& southwest,
56  const LatLong& northeast,
57  double inflatePercent,
58  LatLong& out_southwest,
59  LatLong& out_northeast
60  );
61 
62  bool LatLongBoundsIntersect(const Space::LatLong& southWestA, const Space::LatLong& northEastA,
63  const Space::LatLong& southWestB, const Space::LatLong& northEastB);
64 
65  std::vector<Streaming::MortonKey> CalculateMortonKeysIntersectingBounds(const int keyDepth, const Space::LatLong& southWestLatLong, const Space::LatLong& northEastLatLong);
66 
67  bool IsEcefPointBehindGlobeHorizon(const dv3& pointEcef, const dv3& viewLocationEcef);
68 
69  Eegeo::Geometry::Ray LatLongToVerticallyDownRay(const Space::LatLong& point);
70 
71  Eegeo::dv3 DirectionFromHeadingDegreesAtPoint(double headingDegrees, const dv3& pointEcef);
72 
73  double HeadingDegreesFromDirectionAtPoint(const dv3& directionEcef, const dv3& pointEcef);
74  }
75  }
76 }