X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmath%2FSGLineSegment.hxx;h=c3121c62bba979c796910840dd86f9665447c63f;hb=3cd4c5566f8c418bc9bbb6026072eb0192027993;hp=71cdcc85d2e6fd47cfd08e9f85089485652af02b;hpb=de020ee69524393daf11200aa0a46bfd5aa2409a;p=simgear.git diff --git a/simgear/math/SGLineSegment.hxx b/simgear/math/SGLineSegment.hxx index 71cdcc85..c3121c62 100644 --- a/simgear/math/SGLineSegment.hxx +++ b/simgear/math/SGLineSegment.hxx @@ -27,6 +27,11 @@ public: _start(start), _direction(end - start) { } + template + explicit SGLineSegment(const SGLineSegment& lineSegment) : + _start(lineSegment.getStart()), + _direction(lineSegment.getDirection()) + { } void set(const SGVec3& start, const SGVec3& end) { _start = start; _direction = end - start; } @@ -43,6 +48,14 @@ public: SGVec3 getCenter() const { return _start + T(0.5)*_direction; } + SGLineSegment transform(const SGMatrix& matrix) const + { + SGLineSegment lineSegment; + lineSegment._start = matrix.xformPt(_start); + lineSegment._direction = matrix.xformVec(_direction); + return lineSegment; + } + private: SGVec3 _start; SGVec3 _direction;