3#define DOCTEST_CONFIG_IMPLEMENT
5#include "doctest_utils.h"
9DOCTEST_TEST_CASE(
"VoxelIntersection - Patch with no slices") {
16 uint prim_UUID = context.
addPatch(patch_center, patch_size);
22 voxelintersection.disableMessages();
24 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(2, 2, 2));
26 DOCTEST_CHECK(voxel_UUIDs.size() >= 1);
29DOCTEST_TEST_CASE(
"VoxelIntersection - Patch with one slice") {
36 uint prim_UUID = context.
addPatch(patch_center, patch_size);
42 voxelintersection.disableMessages();
44 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(2, 1, 1));
46 DOCTEST_CHECK(voxel_UUIDs.size() >= 1);
49DOCTEST_TEST_CASE(
"VoxelIntersection - Patch with 2 slices") {
56 uint prim_UUID = context.
addPatch(patch_center, patch_size);
62 voxelintersection.disableMessages();
64 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(3, 1, 1));
66 DOCTEST_CHECK(voxel_UUIDs.size() >= 1);
69DOCTEST_TEST_CASE(
"VoxelIntersection - Patch with 3 slices and no vertices inside voxel") {
76 uint prim_UUID = context.
addPatch(patch_center, patch_size);
82 voxelintersection.disableMessages();
84 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(4, 1, 1));
86 DOCTEST_CHECK(voxel_UUIDs.size() >= 1);
89DOCTEST_TEST_CASE(
"VoxelIntersection - Areas after slicing (non-textured)") {
96 uint prim_UUID = context.
addPatch(patch_center, patch_size);
104 voxelintersection.disableMessages();
106 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(2, 1, 2));
109 for (
uint UUID: voxel_UUIDs) {
113 DOCTEST_CHECK(fabs(area_tot - area_patch) / area_patch < 0.05f);
116DOCTEST_TEST_CASE(
"VoxelIntersection - Textured areas after slicing") {
131 voxelintersection.disableMessages();
133 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(2, 1, 2));
136 for (
uint UUID: voxel_UUIDs) {
140 DOCTEST_CHECK(fabs(area_tot - area_patch) / area_patch < 0.05f);
143DOCTEST_TEST_CASE(
"VoxelIntersection - Cropping non-textured primitives") {
149 uint prim_UUID = tri1_UUID;
155 voxelintersection.disableMessages();
158 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(1, 1, 1));
160 DOCTEST_CHECK(voxel_UUIDs.size() >= 1);
163DOCTEST_TEST_CASE(
"VoxelIntersection - Cropping textured primitives") {
176 voxelintersection.disableMessages();
179 std::vector<uint> voxel_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(1, 1, 1));
181 DOCTEST_CHECK(voxel_UUIDs.size() >= 1);
184DOCTEST_TEST_CASE(
"VoxelIntersection - Basic functionality test") {
191 uint prim_UUID = context.
addPatch(patch_center, patch_size);
194 voxelintersection.disableMessages();
199 std::vector<uint> sliced_UUIDs = voxelintersection.slicePrimitivesUsingGrid(std::vector<uint>{prim_UUID}, grid_center, grid_size,
make_int3(2, 1, 2));
202 DOCTEST_CHECK(sliced_UUIDs.size() >= 1);
206 return helios::runDoctestWithValidation(argc, argv);