SLine3.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionCore.h>
5 
6 
7 namespace ion
8 {
9 
12  template <typename T, typename Vector = vec3<T> >
13  class SLine3
14  {
15 
16  typedef SLine3<T, Vector> Type;
17 
18  public:
19 
20  Vector Start, End;
21 
22  SLine3(Vector const & start, Vector const & end)
23  : Start(start), End(end)
24  {}
25 
26  Vector GetMiddle() const
27  {
28  return (Start + End) / 2;
29  }
30 
31  Vector GetVector() const
32  {
33  return Start - End;
34  }
35 
36  T Length() const
37  {
38  return GetVector().Length();
39  }
40 
41  friend T Length(Type const & Line)
42  {
43  return Line.GetVector().Length();
44  }
45 
46  };
47 
51 
55 
56 }
SLine3< float > line3f
Definition: SLine3.h:52
T Length() const
Definition: SLine3.h:36
SLine3(Vector const &start, Vector const &end)
Definition: SLine3.h:22
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
SLine3< double > line3d
Definition: SLine3.h:53
SLine3< float > SLine3f
Definition: SLine3.h:48
SLine3< int > line3i
Definition: SLine3.h:54
Vector GetMiddle() const
Definition: SLine3.h:26
SLine3< double > SLine3d
Definition: SLine3.h:49
Vector End
Definition: SLine3.h:20
Vector GetVector() const
Definition: SLine3.h:31
Vector Start
Definition: SLine3.h:20
SLine3< int > SLine3i
Definition: SLine3.h:50
3D line segment
Definition: SLine3.h:13
friend T Length(Type const &Line)
Definition: SLine3.h:41