summaryrefslogtreecommitdiffstats
path: root/libdimension/cube.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-14 21:20:43 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-14 21:20:43 -0500
commit8fe33a340b8979a73fa84f201c15519a9b5d0266 (patch)
tree12cdbb1c1b9a48f533ab36980602785be1e1deeb /libdimension/cube.c
parent20a55aa78050d94b187d4edfaac91ea00efea505 (diff)
downloaddimension-8fe33a340b8979a73fa84f201c15519a9b5d0266.tar.xz
Document libdimension with Doxygen.
Diffstat (limited to 'libdimension/cube.c')
-rw-r--r--libdimension/cube.c44
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;
+}