summaryrefslogtreecommitdiffstats
path: root/libdimension/cube.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-02-25 22:03:11 -0500
committerTavian Barnes <tavianator@gmail.com>2010-02-25 22:03:11 -0500
commit40b180db2833e4e6ef835a463ca15ff865ce0d18 (patch)
treeebb3f808374d653cd150852e252e68b9addca8d0 /libdimension/cube.c
parentb27ad82573bc70d84bc4213ba00771f4746b36bc (diff)
downloaddimension-40b180db2833e4e6ef835a463ca15ff865ce0d18.tar.xz
Point the normal vectors away from the object.
Diffstat (limited to 'libdimension/cube.c')
-rw-r--r--libdimension/cube.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libdimension/cube.c b/libdimension/cube.c
index 9815eb6..9588f24 100644
--- a/libdimension/cube.c
+++ b/libdimension/cube.c
@@ -64,7 +64,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line)
&& t_temp >= 0.0 && (t < 0.0 || t_temp < t))
{
t = t_temp;
- normal = dmnsn_new_vector(-copysign(1.0, line.n.x), 0.0, 0.0);
+ normal = dmnsn_new_vector(-1.0, 0.0, 0.0);
}
/* x = 1.0 */
@@ -74,7 +74,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line)
&& t_temp >= 0.0 && (t < 0.0 || t_temp < t))
{
t = t_temp;
- normal = dmnsn_new_vector(-copysign(1.0, line.n.x), 0.0, 0.0);
+ normal = dmnsn_new_vector(1.0, 0.0, 0.0);
}
}
@@ -86,7 +86,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line)
&& t_temp >= 0.0 && (t < 0.0 || t_temp < t))
{
t = t_temp;
- normal = dmnsn_new_vector(0.0, -copysign(1.0, line.n.y), 0.0);
+ normal = dmnsn_new_vector(0.0, -1.0, 0.0);
}
/* y = 1.0 */
@@ -96,7 +96,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line)
&& t_temp >= 0.0 && (t < 0.0 || t_temp < t))
{
t = t_temp;
- normal = dmnsn_new_vector(0.0, -copysign(1.0, line.n.y), 0.0);
+ normal = dmnsn_new_vector(0.0, 1.0, 0.0);
}
}
@@ -108,7 +108,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line)
&& t_temp >= 0.0 && (t < 0.0 || t_temp < t))
{
t = t_temp;
- normal = dmnsn_new_vector(0.0, 0.0, -copysign(1.0, line.n.z));
+ normal = dmnsn_new_vector(0.0, 0.0, -1.0);
}
/* z = 1.0 */
@@ -118,7 +118,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line)
&& t_temp >= 0.0 && (t < 0.0 || t_temp < t))
{
t = t_temp;
- normal = dmnsn_new_vector(0.0, 0.0, -copysign(1.0, line.n.z));
+ normal = dmnsn_new_vector(0.0, 0.0, 1.0);
}
}