Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_plane.h
Go to the documentation of this file.
1 /*
2  Copyright 2010-2017 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 _A_PLANE_H_
17 #define _A_PLANE_H_
18 
19 #include <iostream>
20 #include "a_3dh.h"
21 #include "a_point.h"
22 #include "a_segment.h"
23 #include "a_coord.h"
24 
31 class a_plane : public a_3dh
32 {
33  public:
34  a_plane() {};
36  a_plane(const a_point& p1, const a_point& p2, const a_point& p3);
37  a_plane(const a_plane& p) {X(p.X()); Y(p.Y()); Z(p.Z());}
38  virtual const std::string classname() { return "a_plane";}
39  static const std::string help();
41  a_point n() const;
43  double d0() const {return this->Z();}
44  void d0(const double d) {this->Z(d);}
46  a_point p0() const;
48  double dist(const a_point& p) const;
50  a_point closest(const a_point& p) const;
52  a_point intersect(const a_segment& s) const;
54  a_segment intersect(const a_plane & p) const;
56  bool contains(const a_point& p) const;
57  void move(a_coord c); //c is changed inside
58 
61 
62  //: input/output
63  virtual void read(std::istream &i);
64  virtual void write(std::ostream &o) const;
65  friend std::istream& operator>> (std::istream& i, a_plane& m);
66  friend std::ostream& operator<< (std::ostream& o, const a_plane& m);
67 
68  protected:
69 };
70 
71 #endif
an homogeneous 3d matrix class
Definition: a_3dh.h:30
double Z() const
Definition: a_3dh.h:48
double X() const
Definition: a_3dh.h:46
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 Y(double v)
Definition: a_3dh.h:43
a coordinate system in the Points&Forces file format
Definition: a_coord.h:33
a plane
Definition: a_plane.h:32
bool contains(const a_point &p) const
check whether point is in plane
Definition: a_plane.cxx:113
friend std::ostream & operator<<(std::ostream &o, const a_plane &m)
Definition: a_plane.cxx:161
static const std::string help()
Definition: a_plane.cxx:22
a_plane(const a_plane &p)
Definition: a_plane.h:37
virtual const std::string classname()
Definition: a_plane.h:38
virtual void read(std::istream &i)
Definition: a_plane.cxx:137
void d0(const double d)
Definition: a_plane.h:44
double d0() const
closest distance to origin
Definition: a_plane.h:43
a_plane()
Definition: a_plane.h:34
double dist(const a_point &p) const
distance between p and plane
Definition: a_plane.cxx:66
friend std::istream & operator>>(std::istream &i, a_plane &m)
Definition: a_plane.cxx:155
a_point intersect(const a_segment &s) const
intersection of plane with a segment
Definition: a_plane.cxx:76
void move(a_coord c)
Definition: a_plane.cxx:120
a_point closest(const a_point &p) const
point on the plane closest to p
Definition: a_plane.cxx:71
virtual void write(std::ostream &o) const
Definition: a_plane.cxx:147
a_point p0() const
closest point to origin
Definition: a_plane.cxx:61
a_point n() const
normal to the plane (direction: given by rotation p1-p2-p3)
Definition: a_plane.cxx:56
a segment
Definition: a_segment.h:29