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 /dimension/realize.c | |
parent | 2b5d6e5f42f625049e3f9df765e0cf3fbecc6520 (diff) | |
download | dimension-f0d866e2ad137b339eae91c49ce22630f3a9adf9.tar.xz |
New dmnsn_radians() and dmnsn_degrees() conversion functions.
Diffstat (limited to 'dimension/realize.c')
-rw-r--r-- | dimension/realize.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/dimension/realize.c b/dimension/realize.c index 563327c..967c5db 100644 --- a/dimension/realize.c +++ b/dimension/realize.c @@ -142,13 +142,11 @@ dmnsn_realize_rotation(dmnsn_astnode astnode) { dmnsn_assert(astnode.type == DMNSN_AST_ROTATION, "Expected a rotation."); - const double deg2rad = atan(1.0)/45.0; - dmnsn_astnode angle_node; dmnsn_array_get(astnode.children, 0, &angle_node); dmnsn_vector angle = dmnsn_vector_mul( - deg2rad, + dmnsn_radians(1.0), dmnsn_realize_vector(angle_node) ); @@ -266,8 +264,6 @@ dmnsn_realize_camera(dmnsn_astnode astnode) { dmnsn_assert(astnode.type == DMNSN_AST_CAMERA, "Expected a camera."); - const double deg2rad = atan(1.0)/45.0; - dmnsn_astnode_type camera_type = DMNSN_AST_PERSPECTIVE; dmnsn_vector location = dmnsn_new_vector(0.0, 0.0, 0.0); dmnsn_vector direction = dmnsn_new_vector(0.0, 0.0, 1.0); @@ -363,7 +359,7 @@ dmnsn_realize_camera(dmnsn_astnode astnode) case DMNSN_AST_ANGLE: { dmnsn_array_get(item->children, 0, &child); - double angle = deg2rad*dmnsn_realize_float(child); + double angle = dmnsn_radians(dmnsn_realize_float(child)); direction = dmnsn_vector_mul( 0.5*dmnsn_vector_norm(right)/tan(angle/2.0), dmnsn_vector_normalize(direction) |