Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_2dh.h
Go to the documentation of this file.
1 /*
2 Copyright 2010-2019 Pierre SMARS (smars@yuntech.edu.tw)
3 This program is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #ifndef _VE_2D_H_
17 #define _VE_2D_H_
18 
19 #include "a_mat_c.h"
20 #include "a_point2.h"
21 
22 // .NAME a_2dh
23 // .SECTION Author
24 // Pierre Smars
25 
26 #include <iostream>
27 
29 class a_2dh : public a_mat_c
30 {
31 public:
32  inline a_2dh() : a_mat_c(3) {(*this)(2)=1;};
33  inline a_2dh(double x, double y, double t = 1) : a_mat_c(3) {(*this)(0)=x; (*this)(1)=y; (*this)(2)=t;};
34  inline a_2dh(const a_point2& p) : a_mat_c(3) {(*this)(0)=p.x(); (*this)(1)=p.y(); (*this)(2)=1.;};
35  a_2dh(const a_mat& m);
36  static const std::string help();
37  inline void set(double x, double y, double t = 1) {(*this)(0)=x; (*this)(1)=y; (*this)(2)=t;};
38  inline void set(const a_point2& p) {(*this)(0)=p.x(); (*this)(1)=p.y(); (*this)(2)=1.;};
39  inline a_point2 point2() const {return a_point2((*this)(0)/(*this)(2),(*this)(1)/(*this)(2));}
40  inline void X(double v) {(*this)(0) = v;}
41  inline void Y(double v) {(*this)(1) = v;}
42  inline void T(double v) {(*this)(2) = v;}
43  inline double X() const {return (*this)(0);}
44  inline double Y() const {return (*this)(1);}
45  inline double T() const {return (*this)(2);}
46  inline double x() const {return (*this)(0)/(*this)(2);}
47  inline double y() const {return (*this)(1)/(*this)(2);}
48 
49  //: input/output
50  friend std::istream& operator>> (std::istream& i, a_2dh& m);
51  friend std::ostream& operator<< (std::ostream& o, const a_2dh& m);
52 
53 };
54 
55 #endif
an homogeneous 2d matrix class
Definition: a_2dh.h:30
void set(double x, double y, double t=1)
Definition: a_2dh.h:37
friend std::istream & operator>>(std::istream &i, a_2dh &m)
Definition: a_2dh.cxx:33
a_2dh(double x, double y, double t=1)
Definition: a_2dh.h:33
void Y(double v)
Definition: a_2dh.h:41
a_2dh(const a_point2 &p)
Definition: a_2dh.h:34
void T(double v)
Definition: a_2dh.h:42
static const std::string help()
Definition: a_2dh.cxx:4
friend std::ostream & operator<<(std::ostream &o, const a_2dh &m)
Definition: a_2dh.cxx:43
double X() const
Definition: a_2dh.h:43
a_2dh()
Definition: a_2dh.h:32
void X(double v)
Definition: a_2dh.h:40
double T() const
Definition: a_2dh.h:45
a_point2 point2() const
Definition: a_2dh.h:39
double y() const
Definition: a_2dh.h:47
double x() const
Definition: a_2dh.h:46
void set(const a_point2 &p)
Definition: a_2dh.h:38
double Y() const
Definition: a_2dh.h:44
a column matrix unit
Definition: a_mat_c.h:29
Definition: a_mat.h:42
double y() const
Definition: a_point2.h:53
double x() const
Definition: a_point2.h:52