summaryrefslogtreecommitdiffstats
path: root/libdimension/kD_splay_tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/kD_splay_tree.c')
-rw-r--r--libdimension/kD_splay_tree.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libdimension/kD_splay_tree.c b/libdimension/kD_splay_tree.c
index 77e57dd..924d3a9 100644
--- a/libdimension/kD_splay_tree.c
+++ b/libdimension/kD_splay_tree.c
@@ -356,10 +356,13 @@ dmnsn_kD_splay_search_recursive(dmnsn_kD_splay_node *node, dmnsn_line ray,
result.intersection = result_temp.intersection;
t = result.intersection->t;
- /* Transform the normal vector back to the observer's view */
- result.intersection->normal = dmnsn_matrix_vector_mul(
- node->object->trans,
- result.intersection->normal
+ /* Transform the intersection back to the observer's view */
+ result.intersection->ray = ray;
+ result.intersection->normal = dmnsn_vector_normalize(
+ dmnsn_matrix_vector_mul(
+ node->object->trans,
+ result.intersection->normal
+ )
);
} else {
dmnsn_delete_intersection(result_temp.intersection);