/usr/include/unitizedmath.h is in libdewalls-dev 1.0.0+ds1-4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #ifndef UNITIZEDMATH_H
#define UNITIZEDMATH_H
#include "angle.h"
#include "unitizeddouble.h"
#include <cmath>
namespace dewalls
{
inline double usin(UnitizedDouble<Angle> u) {
return sin(u.get(Angle::Radians));
}
inline UnitizedDouble<Angle> uasin(double value) {
return UnitizedDouble<Angle>(asin(value), Angle::Radians);
}
inline double ucos(UnitizedDouble<Angle> u) {
return cos(u.get(Angle::Radians));
}
inline UnitizedDouble<Angle> uacos(double value) {
return UnitizedDouble<Angle>(acos(value), Angle::Radians);
}
inline double utan(UnitizedDouble<Angle> u) {
return tan(u.get(Angle::Radians));
}
inline UnitizedDouble<Angle> uatan(double value) {
return UnitizedDouble<Angle>(atan(value), Angle::Radians);
}
inline UnitizedDouble<Angle> uatan2(double y, double x) {
return UnitizedDouble<Angle>(atan2(y, x), Angle::Radians);
}
template<class T>
inline UnitizedDouble<Angle> uatan2(UnitizedDouble<T> y, UnitizedDouble<T> x) {
return UnitizedDouble<Angle>(atan2(y.get(y.unit()), x.get(y.unit())), Angle::Radians);
}
template<class T>
inline UnitizedDouble<T> usq(UnitizedDouble<T> x) {
double val = x.get(x.unit());
return UnitizedDouble<T>(val * val, x.unit());
}
template<class T>
inline UnitizedDouble<T> umul(UnitizedDouble<T> a, UnitizedDouble<T> b) {
if (!a.isValid() || !b.isValid()) return UnitizedDouble<T>();
return UnitizedDouble<T>(a.get(a.unit()) * b.get(a.unit()), a.unit());
}
template<class T>
inline UnitizedDouble<T> usqrt(UnitizedDouble<T> x) {
return UnitizedDouble<T>(sqrt(x.get(x.unit())), x.unit());
}
template<class T>
inline UnitizedDouble<T> uabs(UnitizedDouble<T> x) {
return UnitizedDouble<T>(fabs(x.get(x.unit())), x.unit());
}
}
#endif // UNITIZEDMATH_H
|