17 #ifndef _IGNITION_LINE3_HH_
18 #define _IGNITION_LINE3_HH_
35 public:
Line3() =
default;
41 this->pts[0] = _line[0];
42 this->pts[1] = _line[1];
50 this->
Set(_ptA, _ptB);
58 public:
Line3(
const double _x1,
const double _y1,
59 const double _x2,
const double _y2)
61 this->
Set(_x1, _y1, _x2, _y2);
71 public:
Line3(
const double _x1,
const double _y1,
72 const double _z1,
const double _x2,
73 const double _y2,
const double _z2)
75 this->
Set(_x1, _y1, _z1, _x2, _y2, _z2);
110 public:
void Set(
const double _x1,
const double _y1,
111 const double _x2,
const double _y2,
114 this->pts[0].Set(_x1, _y1, _z);
115 this->pts[1].Set(_x2, _y2, _z);
125 public:
void Set(
const double _x1,
const double _y1,
126 const double _z1,
const double _x2,
127 const double _y2,
const double _z2)
129 this->pts[0].Set(_x1, _y1, _z1);
130 this->pts[1].Set(_x2, _y2, _z2);
137 return (this->pts[1] - this->pts[0]).Normalize();
144 return this->pts[0].Distance(this->pts[1]);
152 return this->pts[0] == _line[0] && this->pts[1] == _line[1];
160 return !(*
this == _line);
170 return this->pts[_index];
178 std::ostream &_out,
const Line3<T> &_line)
180 _out << _line[0] <<
" " << _line[1];
189 this->pts[0] = _line[0];
190 this->pts[1] = _line[1];
math::Vector3< T > Direction() const
Get the direction of the line.
Definition: Line3.hh:135
T Length() const
Get the length of the line.
Definition: Line3.hh:142
void Set(const double _x1, const double _y1, const double _z1, const double _x2, const double _y2, const double _z2)
Set the start and end point of the line segment.
Definition: Line3.hh:125
void SetA(const math::Vector3< T > &_ptA)
Set the start point of the line segment.
Definition: Line3.hh:90
Line3(const Line3< T > &_line)
Copy constructor.
Definition: Line3.hh:39
Line3< int > Line3i
Definition: Line3.hh:199
Line3()=default
Line Constructor.
Line3< float > Line3f
Definition: Line3.hh:201
friend std::ostream & operator<<(std::ostream &_out, const Line3< T > &_line)
Stream extraction operator.
Definition: Line3.hh:177
void SetB(const math::Vector3< T > &_ptB)
Set the end point of the line segment.
Definition: Line3.hh:97
bool operator!=(const Line3< T > &_line) const
Inequality operator.
Definition: Line3.hh:158
void Set(const math::Vector3< T > &_ptA, const math::Vector3< T > &_ptB)
Set the start and end point of the line segment.
Definition: Line3.hh:81
Exception that is thrown when an out-of-bounds index is encountered.
Definition: IndexException.hh:37
bool operator==(const Line3< T > &_line) const
Equality operator.
Definition: Line3.hh:150
void Set(const double _x1, const double _y1, const double _x2, const double _y2, const double _z=0)
Set the start and end point of the line segment, assuming that both points have the same height...
Definition: Line3.hh:110
Line3(const math::Vector3< T > &_ptA, const math::Vector3< T > &_ptB)
Constructor.
Definition: Line3.hh:48
math::Vector3< T > operator[](const size_t _index) const
Get the start or end point.
Definition: Line3.hh:166
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:37
Line3 & operator=(const Line3< T > &_line)
Assignment operator.
Definition: Line3.hh:187
A three dimensional line segment.
Definition: Line3.hh:32
Line3< double > Line3d
Definition: Line3.hh:200
Line3(const double _x1, const double _y1, const double _z1, const double _x2, const double _y2, const double _z2)
Constructor.
Definition: Line3.hh:71
Line3(const double _x1, const double _y1, const double _x2, const double _y2)
2D Constructor where Z coordinates are 0
Definition: Line3.hh:58