Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_2dh.cxx
Go to the documentation of this file.
1 #include "a_2dh.h"
2 #include <sstream>
3 //---------------------------------------------------------------------------
4 const std::string a_2dh::help()
5 {
6  std::ostringstream o;
7  o << "*****" << std::endl;
8  o << "a_2dh" << std::endl;
9  o << "****" << std::endl;
10  o << "This is a 2 dimensional homogeneous point class" << std::endl;
11  o << "Commands:" << std::endl;
12  o << "--------" << std::endl;
13  o << "X: set or get the homogeneous coordinate" << std::endl;
14  o << "Y: set or get the homogeneous coordinate" << std::endl;
15  o << "T: set or get the homogeneous coordinate" << std::endl;
16  o << "x: get the coordinate (no check)" << std::endl;
17  o << "y: get the coordinate (no check)" << std::endl;
18  o << "set x y (t): set the coordinates" << std::endl;
19  o << "set a_point2: set the coordinates" << std::endl;
20  o << "point2: get a_point2 representation (no check)" << std::endl;
21  return o.str();
22 }
23 //---------------------------------------------------------------------------
24 a_2dh::a_2dh(const a_mat& m) : a_mat_c(3)
25 {
26  if (m.maxi() != maxi_) throw compatibility_error();
27  if (m.maxj() != maxj_) throw compatibility_error();
28  for (int i = 0; i<3; i++)
29  (*this)(i)= m(i,0);
30 }
31 //***************************************************************************
32 //-operator>>----------------------------------------------------------------
33 std::istream& operator>> (std::istream& i, a_2dh & m)
34 {
35  double x,y;
36  i >> x >> y;
37  m.X(x);
38  m.Y(y);
39  m.T(1.);
40  return i;
41 }
42 //-operator<<----------------------------------------------------------------
43 std::ostream& operator<< (std::ostream& o, const a_2dh & m)
44 {
45  o << m.x() << " " << m.y() << std::endl;
46  return o;
47 }
std::istream & operator>>(std::istream &i, a_2dh &m)
Definition: a_2dh.cxx:33
std::ostream & operator<<(std::ostream &o, const a_2dh &m)
Definition: a_2dh.cxx:43
an homogeneous 2d matrix class
Definition: a_2dh.h:30
void Y(double v)
Definition: a_2dh.h:41
void T(double v)
Definition: a_2dh.h:42
static const std::string help()
Definition: a_2dh.cxx:4
a_2dh()
Definition: a_2dh.h:32
void X(double v)
Definition: a_2dh.h:40
double y() const
Definition: a_2dh.h:47
double x() const
Definition: a_2dh.h:46
a column matrix unit
Definition: a_mat_c.h:29
Definition: a_mat.h:42
UI maxj_
Definition: a_mat.h:89
UI maxi_
Definition: a_mat.h:88
UI maxi() const
Definition: a_mat.h:49
UI maxj() const
Definition: a_mat.h:50