_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; }
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;