diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2013-06-09 12:13:13 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2013-06-09 12:14:17 -0400 |
commit | 2820d029004ad603157cf819b5cfd17870cae86e (patch) | |
tree | 1742b1f66e8f876aaffe109ba9a07cd10021d96a /libdimension | |
parent | 62fac6e15e51422a544de01ce6cb01b0921a6706 (diff) | |
download | dimension-2820d029004ad603157cf819b5cfd17870cae86e.tar.xz |
Don't normalize normal vectors unnecessarily.
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/cone.c | 6 | ||||
-rw-r--r-- | libdimension/torus.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/libdimension/cone.c b/libdimension/cone.c index ec230a6..f1536e2 100644 --- a/libdimension/cone.c +++ b/libdimension/cone.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> * + * Copyright (C) 2009-2013 Tavian Barnes <tavianator@tavianator.com> * * * * This file is part of The Dimension Library. * * * @@ -67,9 +67,7 @@ dmnsn_cone_intersection_fn(const dmnsn_object *cone, dmnsn_line l, if (t >= 0.0 && p.y >= -1.0 && p.y <= 1.0) { double r = ((r2 - r1)*p.y + r1 + r2)/2.0; - dmnsn_vector norm = dmnsn_vector_normalized( - dmnsn_new_vector(p.x, -r*(r2 - r1)/2.0, p.z) - ); + dmnsn_vector norm = dmnsn_new_vector(p.x, -r*(r2 - r1)/2.0, p.z); intersection->t = t; intersection->normal = norm; return true; diff --git a/libdimension/torus.c b/libdimension/torus.c index b3ccf9f..0ef8e92 100644 --- a/libdimension/torus.c +++ b/libdimension/torus.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2010-2011 Tavian Barnes <tavianator@tavianator.com> * + * Copyright (C) 2010-2013 Tavian Barnes <tavianator@tavianator.com> * * * * This file is part of The Dimension Library. * * * @@ -122,7 +122,7 @@ dmnsn_torus_intersection_fn(const dmnsn_object *torus, dmnsn_line l, payload->major, dmnsn_vector_normalized(dmnsn_new_vector(p.x, 0.0, p.z)) ); - dmnsn_vector normal = dmnsn_vector_normalized(dmnsn_vector_sub(p, center)); + dmnsn_vector normal = dmnsn_vector_sub(p, center); intersection->t = t; intersection->normal = normal; |