summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/libdimension.texi4
-rw-r--r--libdimension/cube.c6
-rw-r--r--libdimension/dimension/object.h6
-rw-r--r--libdimension/sphere.c6
4 files changed, 12 insertions, 10 deletions
diff --git a/doc/libdimension.texi b/doc/libdimension.texi
index f5dfadc..2303c3b 100644
--- a/doc/libdimension.texi
+++ b/doc/libdimension.texi
@@ -673,8 +673,8 @@ typedef dmnsn_intersection *
dmnsn_object_intersection_fn(const dmnsn_object *object,
dmnsn_line line);
@tindex dmnsn_object_inside_fn
-typedef int dmnsn_object_inside_fn(const dmnsn_object *object,
- dmnsn_vector point);
+typedef bool dmnsn_object_inside_fn(const dmnsn_object *object,
+ dmnsn_vector point);
/* Allocate a dummy object */
@findex dmnsn_new_object()
diff --git a/libdimension/cube.c b/libdimension/cube.c
index 9588f24..8b77da8 100644
--- a/libdimension/cube.c
+++ b/libdimension/cube.c
@@ -29,8 +29,8 @@
/* Cube callbacks */
static dmnsn_intersection *dmnsn_cube_intersection_fn(const dmnsn_object *cube,
dmnsn_line line);
-static int dmnsn_cube_inside_fn(const dmnsn_object *cube,
- dmnsn_vector point);
+static bool dmnsn_cube_inside_fn(const dmnsn_object *cube,
+ dmnsn_vector point);
/* Allocate a new cube object */
dmnsn_object *
@@ -135,7 +135,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line)
}
/* Inside callback for a cube */
-static int
+static bool
dmnsn_cube_inside_fn(const dmnsn_object *cube, dmnsn_vector point)
{
return point.x > -1.0 && point.x < 1.0
diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h
index e607d8c..bd78a35 100644
--- a/libdimension/dimension/object.h
+++ b/libdimension/dimension/object.h
@@ -25,6 +25,8 @@
#ifndef DIMENSION_OBJECT_H
#define DIMENSION_OBJECT_H
+#include <stdbool.h>
+
/* A type to represent a ray-object intersection */
typedef struct dmnsn_intersection {
/* The ray and point which intersected */
@@ -51,8 +53,8 @@ typedef struct dmnsn_object dmnsn_object;
typedef dmnsn_intersection *
dmnsn_object_intersection_fn(const dmnsn_object *object, dmnsn_line line);
-typedef int dmnsn_object_inside_fn(const dmnsn_object *object,
- dmnsn_vector point);
+typedef bool dmnsn_object_inside_fn(const dmnsn_object *object,
+ dmnsn_vector point);
/* dmnsn_object definition */
struct dmnsn_object {
diff --git a/libdimension/sphere.c b/libdimension/sphere.c
index f30c964..f42ef17 100644
--- a/libdimension/sphere.c
+++ b/libdimension/sphere.c
@@ -31,8 +31,8 @@
static dmnsn_intersection *
dmnsn_sphere_intersection_fn(const dmnsn_object *sphere, dmnsn_line line);
-static int dmnsn_sphere_inside_fn(const dmnsn_object *sphere,
- dmnsn_vector point);
+static bool dmnsn_sphere_inside_fn(const dmnsn_object *sphere,
+ dmnsn_vector point);
/* Allocate a new sphere */
dmnsn_object *
@@ -81,7 +81,7 @@ dmnsn_sphere_intersection_fn(const dmnsn_object *sphere, dmnsn_line line)
}
/* Return whether a point is inside a sphere (x**2 + y**2 + z**2 < 1.0) */
-static int
+static bool
dmnsn_sphere_inside_fn(const dmnsn_object *sphere, dmnsn_vector point)
{
return point.x*point.x + point.y*point.y + point.z*point.z < 1.0;