WARPXM v1.10.0
Loading...
Searching...
No Matches
wxmspherical.h
Go to the documentation of this file.
1// WARPXM includes
2#include "warpxm/warpxm_config.h" // for pi
3
4// STL includes
5#include <iostream>
6#include <cmath>
7#include <vector>
8#include <sstream>
9#include <limits>
10
11// typedef double real;
12
13// namespace wxm
14// {
15// constexpr real pi = 3.14159265358979323846264338327950288419716939937510582;
16// }
17
18// forward declaration
20
28{
29public:
31
33
34 // protected:
35 // const SphericalPositionVector& _vecObj;
36};
37
44{
45public:
54 SphericalPositionVector(const std::vector<real> n);
55
62 SphericalPositionVector(const real r, const real theta, const real phi);
63
64 void CalculateFromRTHETAPHI(real r, real theta, real phi);
65
66 // const std::vector<real> get_vec() { return _vec; } const
67
71 real get_r() const
72 {
73 return _r;
74 }
75
80 {
81 return _theta;
82 }
83
87 real get_phi() const
88 {
89 return _phi;
90 }
91
95 real get_x() const
96 {
97 return _vec[0];
98 }
99
103 real get_y() const
104 {
105 return _vec[1];
106 }
107
111 real get_z() const
112 {
113 return _vec[2];
114 }
115
116 // /**
117 // * setter of x
118 // */
119 // const real set_x() const { return _vec[0]; }
120
121 // /**
122 // * setter of y
123 // */
124 // const real set_y() const { return _vec[1]; }
125
126 // /**
127 // * setter of z
128 // */
129 // const real set_z() const { return _vec[2]; }
130
134 void print(std::stringstream& ss);
135
136protected:
145 void set_r(real r)
146 {
147 _r = r;
148 }
149
153 void set_theta(real theta)
154 {
155 _theta = theta;
156 }
157
161 void set_phi(real phi)
162 {
163 _phi = phi;
164 }
165
171
177
183
189
195
201
202 std::vector<real> calculate_vec();
203
204 // attributes
205 std::vector<real> _vec;
209};
This class should be used to convert face normal to a direction in the upper half of a hemisphere wit...
Definition: wxmspherical.h:28
SphericalPositionVector convert(const SphericalPositionVector &vecObj) const
This class computes Cartesian and Spherical components of a poition vector in space emanating from or...
Definition: wxmspherical.h:44
real _r
Definition: wxmspherical.h:206
real calculate_y()
calculate y component is r*sin(theta)*sin(phi)
real get_x() const
getter of x
Definition: wxmspherical.h:95
std::vector< real > _vec
Definition: wxmspherical.h:205
real calculate_x()
calculate x component is r*sin(theta)*cos(phi)
real get_z() const
getter of z
Definition: wxmspherical.h:111
void set_phi(real phi)
setter of phi
Definition: wxmspherical.h:161
real calculate_theta()
theta is the angle off the z axis (gives lattitude) is arccos(z/r) or equivalently arctan2(sqrt(x^2+y...
real get_theta() const
getter of theta
Definition: wxmspherical.h:79
void set_theta(real theta)
setter of theta
Definition: wxmspherical.h:153
real calculate_r()
r is the length of the vector (assumed to emanate from origin) should be sqrt (x**2 + y**2 + z**2)
real get_y() const
getter of y
Definition: wxmspherical.h:103
std::vector< real > calculate_vec()
void print(std::stringstream &ss)
Print attributes.
real _phi
Definition: wxmspherical.h:208
void set_r(real r)
Setters: Shouldn't do these without recalculating all attributes.
Definition: wxmspherical.h:145
SphericalPositionVector(const std::vector< real > n)
Initialize the position vector with Cartesian components (typically a normal)
real get_phi() const
getter of phi
Definition: wxmspherical.h:87
real calculate_phi()
phi is the longitude angle along x-y plane is arctan2(y/x)
real calculate_z()
calculate z component is r*cos(theta)
real get_r() const
getter of r
Definition: wxmspherical.h:71
void CalculateFromRTHETAPHI(real r, real theta, real phi)
SphericalPositionVector(const real r, const real theta, const real phi)
Initialize the position vector with Sphherical components.
real _theta
Definition: wxmspherical.h:207
#define real
Definition: wmoclunstructuredreconstruction.h:11