Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_3dh.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_3D_H_
17 #define _VE_3D_H_
18 
19 #include "a_mat_c.h"
20 #include "a_point.h"
21 
22 // .NAME a_3dh
23 // .SECTION Author
24 // Pierre Smars
25 
26 #include <iostream>
27 
29 class a_3dh : public a_mat_c
30 {
31 public:
32  inline a_3dh() : a_mat_c(4) {(*this)(3)=1;};
33  inline a_3dh(double x, double y, double z, double t=1.) : a_mat_c(4) {(*this)(0)=x; (*this)(1)=y; (*this)(2)=z; (*this)(3)=t;};
34  inline a_3dh(double * x) : a_mat_c(4) {(*this)(0)=x[0]; (*this)(1)=x[1]; (*this)(2)=x[2]; (*this)(3)=1.;};
35  inline a_3dh(const a_point& p) : a_mat_c(4) {(*this)(0)=p.x(); (*this)(1)=p.y(); (*this)(2)=p.z(); (*this)(3)=1.;};
36  a_3dh(const a_mat& m);
37  static const std::string help();
38  inline void set(double x, double y, double z, double t=1.) {(*this)(0)=x; (*this)(1)=y; (*this)(2)=z; (*this)(3)=t;};
39  inline void set(double * x) {(*this)(0)=x[0]; (*this)(1)=x[1]; (*this)(2)=x[2]; (*this)(3)=1.;};
40  inline void set(const a_point& p) {(*this)(0)=p.x(); (*this)(1)=p.y(); (*this)(2)=p.z(); (*this)(3)=1.;};
41  inline a_point point() const {return a_point((*this)(0)/(*this)(3),(*this)(1)/(*this)(3),(*this)(2)/(*this)(3));};
42  inline void X(double v) {(*this)(0) = v;}
43  inline void Y(double v) {(*this)(1) = v;}
44  inline void Z(double v) {(*this)(2) = v;}
45  inline void T(double v) {(*this)(3) = v;}
46  inline double X() const {return (*this)(0);}
47  inline double Y() const {return (*this)(1);}
48  inline double Z() const {return (*this)(2);}
49  inline double T() const {return (*this)(3);}
50  inline double x() const {return (*this)(0)/(*this)(3);}
51  inline double y() const {return (*this)(1)/(*this)(3);}
52  inline double z() const {return (*this)(2)/(*this)(3);}
53 
54  //: input/output
55  friend std::istream& operator>> (std::istream& i, a_3dh& m);
56  friend std::ostream& operator<< (std::ostream& o, const a_3dh& m);
57 };
58 
59 #endif
an homogeneous 3d matrix class
Definition: a_3dh.h:30
void set(double *x)
Definition: a_3dh.h:39
a_3dh()
Definition: a_3dh.h:32
double y() const
Definition: a_3dh.h:51
a_3dh(const a_point &p)
Definition: a_3dh.h:35
friend std::ostream & operator<<(std::ostream &o, const a_3dh &m)
Definition: a_3dh.cxx:61
a_3dh(double *x)
Definition: a_3dh.h:34
void T(double v)
Definition: a_3dh.h:45
double x() const
Definition: a_3dh.h:50
double Z() const
Definition: a_3dh.h:48
double X() const
Definition: a_3dh.h:46
double T() const
Definition: a_3dh.h:49
double z() const
Definition: a_3dh.h:52
void X(double v)
Definition: a_3dh.h:42
void Z(double v)
Definition: a_3dh.h:44
double Y() const
Definition: a_3dh.h:47
void set(double x, double y, double z, double t=1.)
Definition: a_3dh.h:38
friend std::istream & operator>>(std::istream &i, a_3dh &m)
Definition: a_3dh.cxx:50
a_point point() const
Definition: a_3dh.h:41
static const std::string help()
Definition: a_3dh.cxx:19
void Y(double v)
Definition: a_3dh.h:43
void set(const a_point &p)
Definition: a_3dh.h:40
a_3dh(double x, double y, double z, double t=1.)
Definition: a_3dh.h:33
a column matrix unit
Definition: a_mat_c.h:29
Definition: a_mat.h:42
double z() const
Definition: a_point.h:56
double y() const
Definition: a_point.h:55
double x() const
Definition: a_point.h:54