Greens-code
A modular quantum transport code
points.hpp
1 #ifndef POINTS_FOR_GEOMETRY_H
2 #define POINTS_FOR_GEOMETRY_H
3 
4 #include <memory>
5 #include "shared_ptr.hpp"
6 #include "rect_fwd.hpp"
7 #include <cmath>
8 #include <vector>
9 
11 
12 struct point{
13  double x;
14  double y;
15  double z=0;
16  int layer;
17 
18  point():x(0.), y(0.), layer(0.){};
19  point(double xx, double yy, int l = 0):x(xx), y(yy), layer(l){};
20 };
21 
22 struct region{
23  double top() const { return t;};
24  double bottom() const { return b;};
25  double left() const { return l;};
26  double right() const { return r;};
27 
28  double width() const { return (t - b);};
29  double length() const { return (r - l);};
30 
31  region(const point&, const point&);
32 
33  void include(const point&);
34 
35  static region determine_extension(const Rectangle_const_ref&,
36  double rotation = 0);
37 private:
38  double r,t,l,b;
39 
40  region();
41 };
42 
44 public:
46  const point& origin,
47  double rotation = 0.);
48 
49  bool advance();
50 
51  bool eog();
52 
53  double x() const { return p_.x;};
54  double y() const { return p_.y;};
55 
56  double degrees() const { return rotation_;};
57  double rad() const { return rotation_ * M_PI / 180.;};
58 
59  double dx() const;
60  double dy() const;
61  double dphi() const;
62 
63  double width() const;
64 
65  void transform(point&) const;
66 
67  point upper_point() const;
68  point lower_point() const;
69 
70  const geometry_const_Iterator& position() const { return *gci;};
71 
72 private:
73  std::unique_ptr<geometry_const_Iterator> gci;
74 
75  point p_;
76 
77  double rotation_;
78 
79  double cos_alpha;
80  double sin_alpha;
81 
82  void update_angles();
83  void rotate(double& point);
84 };
85 
87 
88  point_Positions(size_t t): r(t){};
89 
90  std::vector<point> r;
91 
92  typedef STD_TR1::shared_ptr<point_Positions> ref;
93 
94  void translate_to (const slice_Position&);
95 };
96 
97 
98 #endif
Definition: points.hpp:43
Definition: iterators.hpp:13
Definition: points.hpp:12
Definition: points.hpp:86
Definition: points.hpp:22