From b6f1834ac17a11c38091ae0c60e53f8f6320b019 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 6 Nov 2010 02:08:32 -0400 Subject: Factor out transformation code from object callbacks. --- libdimension/prtree.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libdimension/prtree.c') diff --git a/libdimension/prtree.c b/libdimension/prtree.c index 3367384..73c2484 100644 --- a/libdimension/prtree.c +++ b/libdimension/prtree.c @@ -605,7 +605,7 @@ dmnsn_prtree_intersection_recursive(const dmnsn_prtree_node *node, if (dmnsn_ray_box_intersection(ray, node->bounding_boxes[i], *t)) { dmnsn_object *object = node->children[i]; dmnsn_intersection local_intersection; - if ((*object->intersection_fn)(object, ray.line, &local_intersection)) { + if (dmnsn_object_intersection(object, ray.line, &local_intersection)) { if (local_intersection.t < *t) { *intersection = local_intersection; *t = local_intersection.t; @@ -636,7 +636,7 @@ dmnsn_prtree_intersection(const dmnsn_prtree *tree, dmnsn_line ray, /* Search the unbounded objects */ DMNSN_ARRAY_FOREACH (dmnsn_object **, object, tree->unbounded) { dmnsn_intersection local_intersection; - if ((*(*object)->intersection_fn)(*object, ray, &local_intersection)) { + if (dmnsn_object_intersection(*object, ray, &local_intersection)) { if (local_intersection.t < t) { *intersection = local_intersection; t = local_intersection.t; @@ -667,7 +667,7 @@ dmnsn_prtree_inside_recursive(const dmnsn_prtree_node *node, dmnsn_vector point) if (dmnsn_bounding_box_contains(node->bounding_boxes[i], point)) { if (node->is_leaf) { dmnsn_object *object = node->children[i]; - if ((*object->inside_fn)(object, point)) + if (dmnsn_object_inside(object, point)) return true; } else { if (dmnsn_prtree_inside_recursive(node->children[i], point)) @@ -684,7 +684,7 @@ dmnsn_prtree_inside(const dmnsn_prtree *tree, dmnsn_vector point) { /* Search the unbounded objects */ DMNSN_ARRAY_FOREACH (dmnsn_object **, object, tree->unbounded) { - if ((*(*object)->inside_fn)(*object, point)) + if (dmnsn_object_inside(*object, point)) return true; } -- cgit v1.2.3