GeoLine.cxx
Go to the documentation of this file.
3 
4 namespace geoalgo {
5 
7  : _pt1(3)
8  , _pt2(3)
9  {}
10 
11  Line::Line(const double x1, const double y1, const double z1,
12  const double x2, const double y2, const double z2)
13  : _pt1 (x1, y1, z1)
14  , _pt2 (x2, y2, z2)
16 
17  Line::Line(const Point_t& pt1, const Point_t& pt2)
18  : _pt1 ( pt1 )
19  , _pt2 ( pt2 )
20  { check_and_raise(pt1,pt2); }
21 
22  const Point_t& Line::Pt1() const { return _pt1; }
23  const Point_t& Line::Pt2() const { return _pt2; }
24 
25  void Line::Pt1(const double x, const double y, const double z)
26  {
27  _pt1[0] = x;
28  _pt1[1] = y;
29  _pt1[2] = z;
31  }
32 
33  void Line::Pt2(const double x, const double y, const double z)
34  {
35  _pt2[0] = x;
36  _pt2[1] = y;
37  _pt2[2] = z;
39  }
40 
41  void Line::check_and_raise(const Point_t& p1, const Point_t& p2) const
42  {
43  if(p1.size()!=3) throw GeoAlgoException("<<check_and_raise>> Pt1 is not 3 dimensional point!");
44  if(p2.size()!=3) throw GeoAlgoException("<<check_and_raise>> Pt2 is not 3 dimensional point!");
45  if(p1 == p2) throw GeoAlgoException("<<check_and_raise>> Two identical points not allowed for Line ctor!");
46  }
47 
48 }
Class def header for a class GeoAlgoException.
Class def header for a class Line.
const Point_t & Pt2() const
Direction getter.
Definition: GeoLine.cxx:23
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:61
const Point_t & Pt1() const
Start getter.
Definition: GeoLine.cxx:22
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:62
list x
Definition: train.py:276
Line()
Default constructor.
Definition: GeoLine.cxx:6
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:41