diff options
Diffstat (limited to 'libdimension/dimension/geometry.h')
-rw-r--r-- | libdimension/dimension/geometry.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libdimension/dimension/geometry.h b/libdimension/dimension/geometry.h index d55126d..c9f036f 100644 --- a/libdimension/dimension/geometry.h +++ b/libdimension/dimension/geometry.h @@ -70,7 +70,7 @@ static const dmnsn_vector dmnsn_x = { 1.0, 0.0, 0.0 }; static const dmnsn_vector dmnsn_y = { 0.0, 1.0, 0.0 }; static const dmnsn_vector dmnsn_z = { 0.0, 0.0, 1.0 }; -/* Min/max macros */ +/* Scalar functions */ DMNSN_INLINE double dmnsn_min(double a, double b) @@ -84,6 +84,18 @@ dmnsn_max(double a, double b) return a > b ? a : b; } +DMNSN_INLINE double +dmnsn_radians(double degrees) +{ + return degrees*M_PI/180.0; +} + +DMNSN_INLINE double +dmnsn_degrees(double radians) +{ + return radians*180.0/M_PI; +} + /* Shorthand for vector/matrix construction */ DMNSN_INLINE dmnsn_vector |