From 042ef96e2c004a963451edc9efa7074316a360c4 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 13 Jun 2009 22:55:32 +0000 Subject: Pass pointer to object in object callbacks. --- libdimension/sphere.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libdimension/sphere.c') 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 /* For malloc */ #include /* 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; } -- cgit v1.2.3