Changeset 220 in pacpusframework for trunk/include
- Timestamp:
- Nov 13, 2013, 10:15:27 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Pacpus/PacpusTools/geodesie.h
r213 r220 190 190 void cartesianToPolar(const _T1 x, const _T1 y, _T2& r, _T2& theta) 191 191 { 192 r = std::sqrt(x * x + y * y); 193 theta = std::atan2(x, y); 192 using ::std::atan2; 193 using ::std::sqrt; 194 195 r = sqrt(x * x + y * y); 196 theta = atan2(x, y); 194 197 } 195 198 … … 198 201 void polarToCartesian(const _T1 r, const _T1 theta, _T2& x, _T2& y) 199 202 { 200 x = r * std::cos(theta); 201 y = r * std::sin(theta); 203 using ::std::cos; 204 using ::std::sin; 205 206 x = r * cos(theta); 207 y = r * sin(theta); 202 208 } 203 209 … … 207 213 void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2& r, _T2& theta, _T2& phi) 208 214 { 209 r = std::sqrt(x * x + y * y + z * z); 210 theta = std::acos(z / r); 211 phi = std::atan2(y, x); 215 using ::std::acos; 216 using ::std::atan2; 217 using ::std::sqrt; 218 219 r = sqrt(x * x + y * y + z * z); 220 theta = acos(z / r); 221 phi = atan2(y, x); 212 222 } 213 223 … … 217 227 void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2& x, _T2& y, _T2& z) 218 228 { 219 x = r * std::sin(theta) * std::cos(phi); 220 y = r * std::sin(theta) * std::sin(phi); 221 z = r * std::cos(theta); 229 using ::std::cos; 230 using ::std::sin; 231 232 x = r * sin(theta) * cos(phi); 233 y = r * sin(theta) * sin(phi); 234 z = r * cos(theta); 222 235 } 223 236
Note:
See TracChangeset
for help on using the changeset viewer.