Whiteboard
An interface and tools for visualizing large and complex datasets
Geometry.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_H
2 #define GEOMETRY_H
3 
4 #include "visual/Whiteboard.h"
5 #include <math.h>
6 
7 class Geometry3D
8 {
9  public:
11  m_dist = 500.;
12  m_phi = 0.;
13  m_theta = 0.;
14  m_offset = 20;
15  }
16 
17  void SetDist(double d) {
18  m_dist = d;
19  }
20 
21  void SetRotation(double phi, double theta) {
22  m_phi = phi;
23  m_theta = theta;
24  }
25 
26  void SetOffset(double d) {
27  m_offset = d;
28  }
29 
30  double Norm(double xr, double yr, double zr) const {
31  double y = xr*cos(m_theta)*sin(m_phi) + yr*(cos(m_phi)*cos(m_theta)-sin(m_phi)*sin(m_theta)*sin(m_phi)) + zr*(sin(m_phi)*cos(m_theta)+cos(m_phi)*sin(m_theta)*sin(m_phi));
32  return m_dist/(m_dist + y);
33  }
34 
35  // Note: the z axis is vertical by default
36  ns_whiteboard::xy_coords Coords(double xr, double yr, double zr) const {
37  double x = xr*cos(m_theta)*cos(m_phi) + yr*(cos(m_theta)*sin(m_phi)+sin(m_phi)*sin(m_theta)*cos(m_phi)) + zr*(sin(m_phi)*sin(m_theta) - cos(m_phi)*sin(m_theta)*cos(m_phi));
38 
39  double y = xr*cos(m_theta)*sin(m_phi) + yr*(cos(m_phi)*cos(m_theta)-sin(m_phi)*sin(m_theta)*sin(m_phi)) + zr*(sin(m_phi)*cos(m_theta)+cos(m_phi)*sin(m_theta)*sin(m_phi));
40 
41  double z = xr*sin(m_theta) - yr*sin(m_phi)*cos(m_theta) + zr*cos(m_phi)*cos(m_theta);
42 
43  double d = sqrt(x*x + z*z + m_dist*m_dist);
44 
45  // cout << "d=" << d << endl;
46  double x1 = x*m_dist/(y+d);
47  double y1 = z*m_dist/(y+d);
48 
50  }
51 
52  private:
53  double m_phi;
54  double m_theta;
55  double m_dist;
56  double m_offset;
57 
58 };
59 
60 
61 
62 
63 
64 #endif //GEOMETRY_H
65 
double m_offset
Definition: Geometry.h:56
double m_theta
Definition: Geometry.h:54
Geometry3D()
Definition: Geometry.h:10
void SetRotation(double phi, double theta)
Definition: Geometry.h:21
pair< double, double > xy_coords
Definition: Whiteboard.h:30
void SetDist(double d)
Definition: Geometry.h:17
File holding the base drawing classes of the whiteboard.
void SetOffset(double d)
Definition: Geometry.h:26
Definition: Geometry.h:7
double Norm(double xr, double yr, double zr) const
Definition: Geometry.h:30
double m_dist
Definition: Geometry.h:55
ns_whiteboard::xy_coords Coords(double xr, double yr, double zr) const
Definition: Geometry.h:36
double m_phi
Definition: Geometry.h:53