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