All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Point3Spline.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Geometry.h"
6 #include "VectorMath.h"
7 #include "Bounds.h"
8 #include <vector>
9 
10 namespace Eegeo
11 {
12  namespace Geometry
13  {
15  {
16  public:
17  Point3Spline();
18  Point3Spline(const std::vector<v3>& points, const std::vector<float>& splineParams, float splineLength, const Bounds3D& bounds);
19  const std::vector<v3>& Points() const { return m_points; }
20  const std::vector<float>& SplineParams() const { return m_splineParams; }
21  float SplineLength() const { return m_splineLength; }
22  int Count() const { return static_cast<int>(m_points.size()); }
23  const Bounds3D& Bounds() const { return m_bounds; }
24 
25  v3 GetInterpolatedPoint(float t) const;
26 
27  float DistanceToPoint(const v3& point, float& out_paramAtClosestApproach) const;
28 
29  float DistanceToLineSegment(const v3& pointA, const v3& pointB, float& out_paramOnSpline, float& paramOnLineSegment) const;
30 
31  float DistanceNearestPointToLineSegment(const v3& pointA, const v3& pointB, float& out_paramOnSpline, float& paramOnLineSegment) const;
32 
33  int IndexImmediatelyBefore(float param) const;
34 
35  bool IntersectsSphere(const Geometry::SingleSphere& sphere) const;
36 
37  bool IntersectsCapsule(const v3& capsulePointA, const v3& capsulePointB, const float capsuleRadius) const;
38 
39  v3 GetTangentAt(float t) const;
40 
41  static Point3Spline* CreateFromPoints(const std::vector<v3>& points);
42  static Point3Spline BuildFromPoints(const std::vector<v3>& points);
43 
44 
45 
46  private:
47  std::vector<v3> m_points;
48  std::vector<float> m_splineParams;
49  float m_splineLength;
50  Bounds3D m_bounds;
51 
52  };
53  }
54 }