diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-07-03 22:35:59 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-07-03 22:35:59 -0600 |
commit | f0d866e2ad137b339eae91c49ce22630f3a9adf9 (patch) | |
tree | adcedd46c6f5e81bf392fe5712d8081e217c0bac /libdimension/dimension/geometry.h | |
parent | 2b5d6e5f42f625049e3f9df765e0cf3fbecc6520 (diff) | |
download | dimension-f0d866e2ad137b339eae91c49ce22630f3a9adf9.tar.xz |
New dmnsn_radians() and dmnsn_degrees() conversion functions.
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 |