Points&Forces (survey)
Software tools facilitating the task of surveying architecture
e_point.h
Go to the documentation of this file.
1 /*
2  Copyright 2010-2011 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 _E_POINT_H_
17 #define _E_POINT_H_
18 
19 // .NAME e_point
20 // .PORTABILITY : ansi C++
21 // .SECTION Author
22 // Pierre Smars
23 
24 #include <iostream>
25 #include "a_point.h"
26 
28 class e_point : public a_point
29 {
30  public:
31  inline e_point() : x_(0), y_(0), z_(0) {};
32  inline e_point(double x, double y, double z) : x_(x), y_(y), z_(z) {}
33  inline e_point(const double x[3]) : x_(x[0]), y_(x[1]), z_(x[2]) {}
34  inline e_point(const e_point& p) {x_ = p.x_; y_ = p.y_; z_ = p.z_;}
35 
36  //: get coordinates
37  inline double x() const { return x_; };
38  inline double y() const { return y_; };
39  inline double z() const { return z_; };
40 
41  //: set coordinates
42  inline void x(double v) { x_ = v; };
43  inline void y(double v) { y_ = v; };
44  inline void z(double v) { z_ = v; };
45 
46  e_point& operator+=(const e_point&);
47  e_point& operator-=(const e_point&);
48  double operator*=(const e_point&);
49  e_point& operator*=(const double v);
50  e_point& operator/=(const double v);
51 
53  double sumsq() const;
54  double norm() const;
55  e_point& normalise();
56  void print(std::ostream& o);
57 
58  //: input/output
59  friend std::istream& operator>> (std::istream& i, e_point& p);
60  friend std::ostream& operator<< (std::ostream& o, const e_point& p);
61  friend std::istream& operator>> (std::istream& i, e_point* p);
62  friend std::ostream& operator<< (std::ostream& o, const e_point* p);
63 
64  protected:
65  double x_;
66  double y_;
67  double z_;
68  double err_;
69 };
70 
73 double operator*(e_point& a, e_point& b);
74 e_point operator*(double v, e_point& a);
75 e_point operator*(e_point& a, double v);
77 
78 #endif
point + ...
Definition: e_point.h:29
e_point & operator/=(const e_point &)
double err_
Definition: e_point.h:68
e_point(double x, double y, double z)
Definition: e_point.h:32
double z_
Definition: e_point.h:67
e_point(const double x[3])
Definition: e_point.h:33
double operator*=(const e_point &)
Definition: e_point.cxx:36
double z() const
Definition: e_point.h:39
double x() const
Definition: e_point.h:37
double y_
Definition: e_point.h:66
void y(double v)
Definition: e_point.h:43
void z(double v)
Definition: e_point.h:44
double norm() const
Definition: e_point.cxx:62
friend std::istream & operator>>(std::istream &i, e_point &p)
Definition: e_point.cxx:115
e_point & operator+=(const e_point &)
Definition: e_point.cxx:20
double y() const
Definition: e_point.h:38
e_point & operator-=(const e_point &)
Definition: e_point.cxx:28
double sumsq() const
Definition: e_point.cxx:57
void x(double v)
Definition: e_point.h:42
void print(std::ostream &o)
Definition: e_point.cxx:147
e_point()
Definition: e_point.h:31
e_point & normalise()
Definition: e_point.cxx:67
e_point & operator/=(const double v)
Definition: e_point.cxx:49
e_point(const e_point &p)
Definition: e_point.h:34
friend std::ostream & operator<<(std::ostream &o, const e_point &p)
Definition: e_point.cxx:123
double x_
Definition: e_point.h:65
e_point cross(e_point &a, e_point &b)
Definition: e_point.cxx:105
double operator*(e_point &a, e_point &b)
Definition: e_point.cxx:87
e_point operator-(e_point &a, e_point &b)
Definition: e_point.cxx:81
e_point operator+(e_point &a, e_point &b)
Definition: e_point.cxx:75
double v(const uint32_t step, const uint32_t n)
Definition: generate.cxx:42