]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/SGLineSegment.hxx
Merge branch 'timoore/effects'
[simgear.git] / simgear / math / SGLineSegment.hxx
index 71cdcc85d2e6fd47cfd08e9f85089485652af02b..c3121c62bba979c796910840dd86f9665447c63f 100644 (file)
@@ -27,6 +27,11 @@ public:
     _start(start),
     _direction(end - start)
   { }
+  template<typename S>
+  explicit SGLineSegment(const SGLineSegment<S>& lineSegment) :
+    _start(lineSegment.getStart()),
+    _direction(lineSegment.getDirection())
+  { }
 
   void set(const SGVec3<T>& start, const SGVec3<T>& end)
   { _start = start; _direction = end - start; }
@@ -43,6 +48,14 @@ public:
   SGVec3<T> getCenter() const
   { return _start + T(0.5)*_direction; }
 
+  SGLineSegment<T> transform(const SGMatrix<T>& matrix) const
+  {
+    SGLineSegment<T> lineSegment;
+    lineSegment._start = matrix.xformPt(_start);
+    lineSegment._direction = matrix.xformVec(_direction);
+    return lineSegment;
+  }
+
 private:
   SGVec3<T> _start;
   SGVec3<T> _direction;