summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension/dimension/object.h6
-rw-r--r--libdimension/sphere.c10
2 files changed, 10 insertions, 6 deletions
diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h
index c79d62e..b9702f4 100644
--- a/libdimension/dimension/object.h
+++ b/libdimension/dimension/object.h
@@ -25,8 +25,10 @@
* Objects.
*/
-typedef dmnsn_array *dmnsn_object_intersections_fn(dmnsn_line line);
-typedef int dmnsn_object_inside_fn(dmnsn_vector point);
+typedef dmnsn_array *dmnsn_object_intersections_fn(const dmnsn_object *object,
+ dmnsn_line line);
+typedef int dmnsn_object_inside_fn(const dmnsn_object *object,
+ dmnsn_vector point);
typedef struct {
/* Generic pointer for object info */
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;
}