Astro  v0.0.0
A C++ library for space dynamics
Loading...
Searching...
No Matches
Utilities.hxx
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2 * Copyright (c) 2025, Davide Stocco and Enrico Bertolazzi. *
3 * *
4 * The Astro project is distributed under the BSD 2-Clause License. *
5 * *
6 * Davide Stocco Enrico Bertolazzi *
7 * University of Trento University of Trento *
8 * e-mail: davide.stocco@unitn.it e-mail: enrico.bertolazzi@unitn.it *
9\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
11#pragma once
12
13#ifndef ASTRO_UTILITIES_HXX
14#define ASTRO_UTILITIES_HXX
15
16namespace Astro {
17
18 /*\
19 | _ _ _ _ _ _ _ _
20 | | | | | |_(_) (_) |_(_) ___ ___
21 | | | | | __| | | | __| |/ _ \/ __|
22 | | |_| | |_| | | | |_| | __/\__ \
23 | \___/ \__|_|_|_|\__|_|\___||___/
24 |
25 \*/
26
30 Real power2(Real x) {return x*x;}
31
35 Real power3(Real x) {return x*x*x;}
36
41 static Real degrees_to_radiants(Real x) {return DEG2RAD*x;}
42
47 static Real radiants_to_degrees(Real x) {return RAD2DEG*x;}
48
53 x = std::fmod(x, PIMUL2);
54 while (x < Real(0.0)) {x += PIMUL2;}
55 while (x > PIMUL2) {x -= PIMUL2;}
56 }
57
62 x = std::fmod(x, PIMUL2);
63 while (x < -PI) {x += PIMUL2;}
64 while (x > PI) {x -= PIMUL2;}
65 }
66
67} // namespace Astro
68
69#endif // ASTRO_UTILITIES_HXX
The namespace for the Astro library.
static Real const PI
Pi static constant value.
Definition Astro.hh:132
void angle_in_range(Real x)
Definition Utilities.hxx:52
static Real degrees_to_radiants(Real x)
Definition Utilities.hxx:41
static Real const RAD2DEG
The value of .
Definition Astro.hh:136
static Real const DEG2RAD
The value of .
Definition Astro.hh:135
void angle_in_range_sym(Real x)
Definition Utilities.hxx:61
double Real
Real number type.
Definition Astro.hh:83
Real power2(Real x)
Definition Utilities.hxx:30
Real power3(Real x)
Definition Utilities.hxx:35
static Real const PIMUL2
The value of .
Definition Astro.hh:133
static Real radiants_to_degrees(Real x)
Definition Utilities.hxx:47