diff options
Diffstat (limited to 'libdimension/cube.c')
-rw-r--r-- | libdimension/cube.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/libdimension/cube.c b/libdimension/cube.c index c70ebf6..6e3120e 100644 --- a/libdimension/cube.c +++ b/libdimension/cube.c @@ -18,33 +18,15 @@ * <http://www.gnu.org/licenses/>. * *************************************************************************/ -#include "dimension.h" -#include <math.h> - -/* - * Cube +/** + * @file + * Cubes. */ -/* Cube callbacks */ -static bool dmnsn_cube_intersection_fn(const dmnsn_object *cube, - dmnsn_line line, - dmnsn_intersection *intersection); -static bool dmnsn_cube_inside_fn(const dmnsn_object *cube, - dmnsn_vector point); - -/* Allocate a new cube object */ -dmnsn_object * -dmnsn_new_cube() -{ - dmnsn_object *cube = dmnsn_new_object(); - cube->intersection_fn = &dmnsn_cube_intersection_fn; - cube->inside_fn = &dmnsn_cube_inside_fn; - cube->bounding_box.min = dmnsn_new_vector(-1.0, -1.0, -1.0); - cube->bounding_box.max = dmnsn_new_vector(1.0, 1.0, 1.0); - return cube; -} +#include "dimension.h" +#include <math.h> -/* Intersections callback for a cube */ +/** Intersection callback for a cube. */ static bool dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line, dmnsn_intersection *intersection) @@ -141,7 +123,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line, } } -/* Inside callback for a cube */ +/** Inside callback for a cube. */ static bool dmnsn_cube_inside_fn(const dmnsn_object *cube, dmnsn_vector point) { @@ -149,3 +131,15 @@ dmnsn_cube_inside_fn(const dmnsn_object *cube, dmnsn_vector point) && point.y > -1.0 && point.y < 1.0 && point.z > -1.0 && point.z < 1.0; } + +/* Allocate a new cube object */ +dmnsn_object * +dmnsn_new_cube() +{ + dmnsn_object *cube = dmnsn_new_object(); + cube->intersection_fn = &dmnsn_cube_intersection_fn; + cube->inside_fn = &dmnsn_cube_inside_fn; + cube->bounding_box.min = dmnsn_new_vector(-1.0, -1.0, -1.0); + cube->bounding_box.max = dmnsn_new_vector(1.0, 1.0, 1.0); + return cube; +} |