VectorNav C++ Library
conversions.h
1 #ifndef _VN_MATH_CONVERSIONS_H_
2 #define _VN_MATH_CONVERSIONS_H_
3 
4 #include "export.h"
5 #include "vector.h"
6 #include "matrix.h"
7 
8 namespace vn {
9 namespace math {
10 
14 
19 float rad2deg(float angleInRads);
20 
25 double rad2deg(double angleInRads);
26 
31 template<size_t dim>
33 {
34  for (size_t i = 0; i < dim; i++)
35  anglesInRads[i] = rad2deg(anglesInRads[i]);
36 
37  return anglesInRads;
38 }
39 
44 float vn_proglib_DLLEXPORT deg2rad(float angleInDegs);
45 
50 double vn_proglib_DLLEXPORT deg2rad(double angleInDegs);
51 
56 //template<size_t dim>
57 //vec<dim, float> vn_proglib_DLLEXPORT deg2rad(vec<dim> anglesInDegs)
58 template<size_t dim>
60 {
61  for (size_t i = 0; i < dim; i++)
62  anglesInDegs[i] = deg2rad(anglesInDegs[i]);
63 
64  return anglesInDegs;
65 }
66 
68 
72 
77 float celsius2fahren(float tempInCelsius);
78 
83 double celsius2fahren(double tempInCelsius);
84 
89 float fahren2celsius(float tempInFahren);
90 
95 double fahren2celsius(double tempInFahren);
96 
101 float celsius2kelvin(float tempInCelsius);
102 
107 double celsius2kelvin(double tempInCelsius);
108 
113 float kelvin2celsius(float tempInKelvin);
114 
119 double kelvin2celsius(double tempInKelvin);
120 
125 float fahren2kelvin(float tempInFahren);
126 
131 double fahren2kelvin(double tempInFahren);
132 
137 float kelvin2fahren(float tempInKelvin);
138 
143 double kelvin2fahren(double tempInKelvin);
144 
146 
152 vec4f yprInDegs2Quat(vec3f yprInDegs);
153 
159 vec4f yprInRads2Quat(vec3f yprInRads);
160 
165 mat3f yprInDegs2Dcm(vec3f yprInDegs);
166 
171 mat3f yprInRads2Dcm(vec3f yprInRads);
172 
178 vec3f quat2YprInDegs(vec4f quat);
179 
185 vec3f quat2YprInRads(vec4f quat);
186 
192 mat3f quat2dcm(vec4f quat);
193 
198 vec3f dcm2YprInDegs(mat3f dcm);
199 
204 vec3f dcm2YprInRads(mat3f dcm);
205 
211 vec4f dcm2quat(mat3f dcm);
212 
219 float vn_proglib_DLLEXPORT course_over_ground(float velNedX, float velNedY);
220 
226 float vn_proglib_DLLEXPORT course_over_ground(vec3f velNed);
227 
234 float vn_proglib_DLLEXPORT speed_over_ground(float velNedX, float velNedY);
235 
241 float vn_proglib_DLLEXPORT speed_over_ground(vec3f velNed);
242 
247 vec3f vn_proglib_DLLEXPORT quat2omegaPhiKappaInRads(vec4f quat);
248 
253 vec3f vn_proglib_DLLEXPORT dcm2omegaPhiKappaInRads(mat3f dcm);
254 
259 vec3f vn_proglib_DLLEXPORT yprInDegs2omegaPhiKappaInRads(vec3f yprDegs);
260 
265 vec3f vn_proglib_DLLEXPORT yprInRads2omegaPhiKappaInRads(vec3f yprRads);
266 
267 }
268 }
269 
270 #endif
vec< dim, float > deg2rad(vec< dim > anglesInDegs)
Convers a vector of angles in degrees to radians.
Definition: conversions.h:59
double fahren2kelvin(double tempInFahren)
Converts a temperature in Fahrenheit to Kelvin.
Template for a Euclidean vector.
Definition: vector.h:22
double kelvin2celsius(double tempInKelvin)
Converts a temperature in Kelvin to Celsius.
double celsius2fahren(double tempInCelsius)
Converts a temperature in Celsius to Fahrenheit.
double fahren2celsius(double tempInFahren)
Converts a temperature in Fahrenheit to Celsius.
vec< dim, float > rad2deg(vec< dim > anglesInRads)
Convers a vector of angles in radians to degrees.
Definition: conversions.h:32
double kelvin2fahren(double tempInKelvin)
Converts a temperature in Kelvin to Fahrenheit.
Definition: attitude.h:8
double celsius2kelvin(double tempInCelsius)
Converts a temperature in Celsius to Kelvin.