From f0d866e2ad137b339eae91c49ce22630f3a9adf9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 3 Jul 2010 22:35:59 -0600 Subject: New dmnsn_radians() and dmnsn_degrees() conversion functions. --- libdimension/dimension/geometry.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'libdimension') 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 -- cgit v1.2.3