summaryrefslogtreecommitdiffstats
path: root/libdimension/sphere.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-06-13 22:55:32 +0000
committerTavian Barnes <tavianator@gmail.com>2009-06-13 22:55:32 +0000
commit042ef96e2c004a963451edc9efa7074316a360c4 (patch)
tree65140c2248010a79982226ae2ef75ceeae006a02 /libdimension/sphere.c
parent5e605e80937a02a55e2d2b94bce715ff937e0d26 (diff)
downloaddimension-042ef96e2c004a963451edc9efa7074316a360c4.tar.xz
Pass pointer to object in object callbacks.
Diffstat (limited to 'libdimension/sphere.c')
-rw-r--r--libdimension/sphere.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libdimension/sphere.c b/libdimension/sphere.c
index a14070e..74f414d 100644
--- a/libdimension/sphere.c
+++ b/libdimension/sphere.c
@@ -22,8 +22,10 @@
#include <stdlib.h> /* For malloc */
#include <math.h> /* For sqrt */
-static dmnsn_array *dmnsn_sphere_intersections_fn(dmnsn_line line);
-static int dmnsn_sphere_inside_fn(dmnsn_vector point);
+static dmnsn_array *dmnsn_sphere_intersections_fn(const dmnsn_sphere *sphere,
+ dmnsn_line line);
+static int dmnsn_sphere_inside_fn(const dmnsn_sphere *sphere,
+ dmnsn_vector point);
dmnsn_object *
dmnsn_new_sphere()
@@ -43,7 +45,7 @@ dmnsn_delete_sphere(dmnsn_object *sphere)
}
static dmnsn_array *
-dmnsn_sphere_intersections_fn(dmnsn_line line)
+dmnsn_sphere_intersections_fn(const dmnsn_object *sphere, dmnsn_line line)
{
double a, b, c, t[2];
dmnsn_array *array = dmnsn_new_array(sizeof(double));
@@ -65,7 +67,7 @@ dmnsn_sphere_intersections_fn(dmnsn_line line)
}
static int
-dmnsn_sphere_inside_fn(dmnsn_vector point)
+dmnsn_sphere_inside_fn(const dmnsn_object *sphere, dmnsn_vector point)
{
return sqrt(point.x*point.x + point.y*point.y + point.z*point.z) < 1.0;
}