commit 670ec3ea1c40d29c2748f482f2664cbfb418e522
parent f9886dd5d4598be8dc0af90d39ebee72f6416ce9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 23 May 2025 15:06:29 +0200
Merge branch 'release_0.3.1'
Diffstat:
24 files changed, 137 insertions(+), 153 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+# Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
# Copyright (C) 2018 Université Paul Sabatier
#
# This program is free software: you can redistribute it and/or modify
@@ -23,6 +23,9 @@ LIBNAME_STATIC = libsvx.a
LIBNAME_SHARED = libsvx.so
LIBNAME = $(LIBNAME_$(LIB_TYPE))
+default: library
+all: default tests
+
################################################################################
# Library building
################################################################################
@@ -37,18 +40,21 @@ SRC =\
OBJ = $(SRC:.c=.o)
DEP = $(SRC:.c=.d)
-build_library: .config $(DEP)
+CFLAGS_LIB = $(CFLAGS_SO) $(INCS) -DSVX_SHARED_BUILD
+LDFLAGS_LIB = $(LDFLAGS_SO) $(LIBS)
+
+library: .config $(DEP)
@$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) \
$$(if [ -n "$(LIBNAME)" ]; then \
- echo "$(LIBNAME)"; \
- else \
- echo "$(LIBNAME_SHARED)"; \
- fi)
+ echo "$(LIBNAME)"; \
+ else \
+ echo "$(LIBNAME_SHARED)"; \
+ fi)
$(DEP) $(OBJ): config.mk
$(LIBNAME_SHARED): $(OBJ)
- $(CC) $(CFLAGS_SO) $(RSYS_CFLAGS) -o $@ $(OBJ) $(LDFLAGS_SO) $(RSYS_LIBS) -lm
+ $(CC) $(CFLAGS_LIB) -o $@ $(OBJ) $(LDFLAGS_LIB)
$(LIBNAME_STATIC): libsvx.o
$(AR) -rc $@ $?
@@ -59,19 +65,18 @@ libsvx.o: $(OBJ)
$(OBJCOPY) $(OCPFLAGS) $@
.config: config.mk
- @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
- echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
+ $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys
@echo "config done" > $@
.SUFFIXES: .c .d .o
.c.d:
- @$(CC) $(CFLAGS_SO) $(RSYS_CFLAGS) -MM -MT "$(@:.d=.o) $@" $< -MF $@
+ @$(CC) $(CFLAGS_LIB) -MM -MT "$(@:.d=.o) $@" $< -MF $@
.c.o:
- $(CC) $(CFLAGS_SO) $(RSYS_CFLAGS) -DSVX_SHARED_BUILD -c $< -o $@
+ $(CC) $(CFLAGS_LIB) -c $< -o $@
################################################################################
-# Installation
+# Miscellaneous
################################################################################
pkg:
sed -e 's#@PREFIX@#$(PREFIX)#g'\
@@ -87,11 +92,16 @@ svx-local.pc: svx.pc.in
-e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g'\
svx.pc.in > $@
-install: build_library pkg
- @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/lib" $(LIBNAME)
- @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/lib/pkgconfig" svx.pc
- @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/include/star" src/svx.h
- @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/star-vx" COPYING README.md
+install: library pkg
+ install() { mode="$$1"; prefix="$$2"; shift 2; \
+ mkdir -p "$${prefix}"; \
+ cp "$$@" "$${prefix}"; \
+ chmod "$${mode}" "$$@"; \
+ }; \
+ install 755 "$(DESTDIR)$(LIBPREFIX)" $(LIBNAME); \
+ install 644 "$(DESTDIR)$(LIBPREFIX)/pkgconfig" svx.pc; \
+ install 644 "$(DESTDIR)$(INCPREFIX)/star" src/svx.h; \
+ install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-vx" COPYING README.md
uninstall:
rm -f "$(DESTDIR)$(PREFIX)/lib/$(LIBNAME)"
@@ -100,20 +110,9 @@ uninstall:
rm -f "$(DESTDIR)$(PREFIX)/share/doc/star-vx/README.md"
rm -f "$(DESTDIR)$(PREFIX)/include/star/svx.h"
-################################################################################
-# Miscellaneous targets
-################################################################################
-all: build_library build_tests
-
clean: clean_test
- rm -f $(OBJ) $(TEST_OBJ) $(LIBNAME)
- rm -f .config .test libsvx.o svx.pc svx-local.pc
-
-distclean: clean
- rm -f $(DEP) $(TEST_DEP)
-
-lint:
- shellcheck -o all make.sh
+ rm -f $(DEP) $(OBJ) $(LIBNAME)
+ rm -f .config libsvx.o svx.pc svx-local.pc
################################################################################
# Tests
@@ -126,29 +125,33 @@ TEST_SRC =\
src/test_svx_octree_trace_ray.c
TEST_OBJ = $(TEST_SRC:.c=.o)
TEST_DEP = $(TEST_SRC:.c=.d)
+TEST_TGT = $(TEST_SRC:.c=.t)
PKG_CONFIG_LOCAL = PKG_CONFIG_PATH="./:$${PKG_CONFIG_PATH}" $(PKG_CONFIG)
-SVX_CFLAGS = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags svx-local.pc)
-SVX_LIBS = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --libs svx-local.pc)
+INCS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags rsys svx-local.pc)
+LIBS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --libs rsys svx-local.pc) -lm
-build_tests: build_library $(TEST_DEP) .test
- @$(MAKE) -fMakefile -f.test $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) test_bin
+CFLAGS_TEST = $(CFLAGS_EXE) $(INCS_TEST)
+LDFLAGS_TEST = $(LDFLAGS_EXE) $(LIBS_TEST)
-test: build_tests
- @$(SHELL) make.sh run_test $(TEST_SRC)
+tests: library $(TEST_DEP) $(TEST_TGT)
+ @$(MAKE) -fMakefile \
+ $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) \
+ $$(for i in $(TEST_TGT); do echo -f"$${i}"; done) \
+ test_list
-.test: Makefile
- @$(SHELL) make.sh config_test $(TEST_SRC) > $@
-
-clean_test:
- @$(SHELL) make.sh clean_test $(TEST_SRC)
+$(TEST_TGT):
+ @{ \
+ exe="$$(basename "$@" ".t")"; \
+ printf '%s: %s\n' "$${exe}" $(@:.t=.o); \
+ printf 'test_list: %s\n' "$${exe}"; \
+ } > $@
$(TEST_DEP): config.mk svx-local.pc
- @$(CC) $(CFLAGS_EXE) $(RSYS_CFLAGS) $(SVX_CFLAGS) \
- -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
+ @$(CC) $(CFLAGS_TEST) -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
$(TEST_OBJ): config.mk svx-local.pc
- $(CC) $(CFLAGS_EXE) $(RSYS_CFLAGS) $(SVX_CFLAGS) -c $(@:.o=.c) -o $@
+ $(CC) $(CFLAGS_TEST) -c $(@:.o=.c) -o $@
test_svx_bintree \
test_svx_bintree_trace_ray \
@@ -156,4 +159,20 @@ test_svx_device \
test_svx_octree \
test_svx_octree_trace_ray \
: config.mk svx-local.pc $(LIBNAME)
- $(CC) $(CFLAGS_EXE) -o $@ src/$@.o $(LDFLAGS_EXE) $(SVX_LIBS) $(RSYS_LIBS) -lm
+ $(CC) $(CFLAGS_TEST) -o $@ src/$@.o $(LDFLAGS_TEST)
+clean_test:
+ rm -f $(TEST_DEP) $(TEST_OBJ) $(TEST_TGT)
+ for i in $(TEST_SRC); do rm -f "$$(basename "$${i}" ".c")"; done
+
+test: tests
+ @err=0; \
+ for i in $(TEST_SRC); do \
+ test="$$(basename "$${i}" ".c")"; \
+ if "./$${test}" > /dev/null 2>&1; then \
+ printf '%s\n' "$${test}"; \
+ else \
+ >&2 printf '%s: error %s\n' "$${test}" "$$?"; \
+ err=$$((err+1)); \
+ fi \
+ done; \
+ [ "$${err}" -eq 0 ]
diff --git a/README.md b/README.md
@@ -37,6 +37,14 @@ Edit config.mk as needed, then run:
## Release notes
+### Version 0.3.1
+
+- Fix ray-tracing inaccuracy in a binary tree when the ray direction is
+ approximately aligned with the infinite dimension.
+- Improve the build system.
+ Simplify it by doing everything in one place (the Makefile).
+ Add macros to control installation sub-directories.
+
### Version 0.3
- Replace CMake by Makefile as build system.
@@ -67,7 +75,7 @@ become obsolete.
## License
-Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
Copyright (C) 2018 Université Paul Sabatier
Star-VX is free software released under the GPL v3+ license: GNU GPL
diff --git a/config.mk b/config.mk
@@ -1,4 +1,4 @@
-VERSION = 0.3
+VERSION = 0.3.1
PREFIX = /usr/local
LIB_TYPE = SHARED
@@ -7,6 +7,9 @@ LIB_TYPE = SHARED
BUILD_TYPE = RELEASE
#BUILD_TYPE = DEBUG
+LIBPREFIX = $(PREFIX)/libs
+INCPREFIX = $(PREFIX)/include
+
################################################################################
# Tools
################################################################################
@@ -24,9 +27,9 @@ PCFLAGS_SHARED =
PCFLAGS_STATIC = --static
PCFLAGS = $(PCFLAGS_$(LIB_TYPE))
-RSYS_VERSION=0.14
-RSYS_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys)
-RSYS_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys)
+RSYS_VERSION = 0.14
+INCS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys)
+LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys) -lm
################################################################################
# Compilation options
diff --git a/make.sh b/make.sh
@@ -1,71 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
-# Copyright (C) 2018 Université Paul Sabatier
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-config_test()
-{
- for i in "$@"; do
- test=$(basename "${i}" ".c")
- test_list="${test_list} ${test}"
- printf "%s: %s\n" "${test}" "src/${test}.o"
- done
- printf "test_bin: %s\n" "${test_list}"
-}
-
-run_test()
-{
- for i in "$@"; do
- test=$(basename "${i}" ".c")
-
- printf "%s " "${test}"
- if "./${test}" > /dev/null 2>&1; then
- printf "\033[1;32mOK\033[m\n"
- else
- printf "\033[1;31mError\033[m\n"
- fi
- done 2> /dev/null
-}
-
-clean_test()
-{
- for i in "$@"; do
- rm -f "$(basename "${i}" ".c")"
- done
-}
-
-install()
-{
- prefix=$1
- shift 1
-
- mkdir -p "${prefix}"
-
- for i in "$@"; do
- dst="${prefix}/${i##*/}"
-
- if cmp -s "${i}" "${dst}"; then
- printf "Up to date %s\n" "${dst}"
- else
- printf "Installing %s\n" "${dst}"
- cp "${i}" "${prefix}"
- fi
- done
-}
-
-"$@"
diff --git a/src/svx.h b/src/svx.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_bintree.c b/src/svx_bintree.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_bintree_trace_ray.c b/src/svx_bintree_trace_ray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
@@ -87,6 +87,7 @@ bintree_trace_ray
struct buffer_index inode;
size_t istack; /* Top of the stack */
size_t iaxis; /* Id in [0, 2] of the axis along which the tree is defined */
+ double rdir[3]; /* Ray direction adjusted wrt numerical problems */
double pos_min, pos_max; /* Min/Max pos along the ray in [0,1] +dir 1D space */
double org; /* Ray origin in the [0,1] +dir 1D space */
double dir; /* Ray direction in the [0,1] +dir 1D space */
@@ -113,17 +114,29 @@ bintree_trace_ray
rcp_btreesz = 1.0 / (double)btree->tree_size[iaxis];
ASSERT(rcp_btreesz > 0);
+ d3_set(rdir, ray_dir);
+
+ /* Define whether the direction of the 1D ray is approximately aligned with the
+ * infinite dimension. If it is, make sure it's really aligned so that the
+ * caller can't have a ray that escapes the voxel from which the ray starts.
+ * Indeed, even with an approximately zero direction along the 1D axis, the ray
+ * can still cross the boundary of a voxel if the caller decides to make it
+ * travel long distances. */
+ null_dir = eq_eps(ray_dir[iaxis], 0, 1.e-6);
+ if(null_dir) {
+ rdir[iaxis] = 0;
+ d3_normalize(rdir, rdir);
+ }
+
/* Transform the ray origin in [0, 1] space */
org = (ray_org[iaxis] - btree->tree_low[iaxis]) * rcp_btreesz;
/* Transform the direction in the normalized bintree space */
- dir = (ray_dir[iaxis] * rcp_btreesz);
- /* Define if the 1D ray direction is roughly null */
- null_dir = eq_eps(ray_dir[iaxis], 0, 1.e-6);
+ dir = (rdir[iaxis] * rcp_btreesz);
/* The ray starts outside the binary tree and point outward the bin tree: it
* cannot intersect the binary tree */
- if((org > 1 && (dir > 0 || null_dir))
- || (org < 0 && (dir < 0 || null_dir)))
+ if((org > 1 && dir >= 0)
+ || (org < 0 && dir <= 0))
return RES_OK;
/* Mirror rays with negative direction */
@@ -161,9 +174,9 @@ bintree_trace_ray
0/*depth*/, 0/*is_leaf*/, flip, &hit_root);
hit_root.voxel.data = btree->root_attr;
- if(challenge(&hit_root, ray_org, ray_dir, ray_range, context)) {
+ if(challenge(&hit_root, ray_org, rdir, ray_range, context)) {
if(!filter /* By default, i.e. with no filter, stop the traversal */
- || !filter(&hit_root, ray_org, ray_dir, ray_range, context)) {
+ || !filter(&hit_root, ray_org, rdir, ray_range, context)) {
*hit = hit_root;
return RES_OK; /* Do not traverse the binary tree */
}
@@ -211,12 +224,12 @@ bintree_trace_ray
flip, &hit_tmp);
if(is_leaf
- || challenge(&hit_tmp, ray_org, ray_dir, ray_range, context)) {
+ || challenge(&hit_tmp, ray_org, rdir, ray_range, context)) {
go_deeper = 0;
/* Stop the traversal if no filter is defined or if the filter
* function returns 0 */
if(!filter /* By default, i.e. with no filter, stop the traversal */
- || !filter(&hit_tmp, ray_org, ray_dir, ray_range, context)) {
+ || !filter(&hit_tmp, ray_org, rdir, ray_range, context)) {
*hit = hit_tmp;
break;
}
@@ -275,4 +288,3 @@ bintree_trace_ray
}
return RES_OK;
}
-
diff --git a/src/svx_buffer.c b/src/svx_buffer.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_buffer.h b/src/svx_buffer.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_c.h b/src/svx_c.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_device.c b/src/svx_device.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_device.h b/src/svx_device.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_octree.c b/src/svx_octree.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_octree_trace_ray.c b/src/svx_octree_trace_ray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_tree.c b/src/svx_tree.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_tree.h b/src/svx_tree.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_tree_builder.h b/src/svx_tree_builder.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/svx_tree_generic_func.h b/src/svx_tree_generic_func.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/test_svx_bintree.c b/src/test_svx_bintree.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/test_svx_bintree_trace_ray.c b/src/test_svx_bintree_trace_ray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
@@ -140,8 +140,17 @@ hit_challenge_pass_through
CHK(hit && ray_org && ray_dir && ray_range && context);
CHK(!SVX_HIT_NONE(hit));
CHK(d3_eq(ray->org, ray_org));
- CHK(d3_eq(ray->dir, ray_dir));
CHK(d2_eq(ray->range, ray_range));
+
+ /* The direction could be adjusted internally when crossing a binary tree.
+ * This avoids numerical inaccuracies in the case of distant intersections,
+ * i.e. when the ray direction is roughly aligned with the third dimension
+ * (i.e. the one that goes to infinity). In this case, the ray direction is
+ * forced to be 0 on this dimension before being renormalized. The ray
+ * therefore never intersects the binary tree. But its direction has changed.
+ * Hence the approximate equality on the direction */
+ CHK(d3_eq_eps(ray->dir, ray_dir, 1.e-6));
+
return 0;
}
@@ -156,9 +165,13 @@ hit_filter
const struct ray* ray = context;
CHK(hit && ray_org && ray_dir && ray_range && context);
CHK(d3_eq(ray->org, ray_org));
- CHK(d3_eq(ray->dir, ray_dir));
CHK(d2_eq(ray->range, ray_range));
CHK(!SVX_HIT_NONE(hit));
+
+ /* The direction could be adjusted internally when crossing a binary tree.
+ * Refer to the hit_challenge_pass_through function */
+ CHK(d3_eq_eps(ray->dir, ray_dir, 1.e-6));
+
return *((char*)hit->voxel.data) == 0;
}
diff --git a/src/test_svx_device.c b/src/test_svx_device.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/test_svx_octree.c b/src/test_svx_octree.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/test_svx_octree_trace_ray.c b/src/test_svx_octree_trace_ray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/test_svx_utils.h b/src/test_svx_utils.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018, 2020-2023 |Méso|Star> (contact@meso-star.com)
+/* Copyright (C) 2018, 2020-2025 |Méso|Star> (contact@meso-star.com)
* Copyright (C) 2018 Université Paul Sabatier
*
* This program is free software: you can redistribute it and/or modify