#include #include "vde/mesh/parallel_mc.h" #include using namespace vde::mesh; static double sphere_sdf(double x, double y, double z) { return std::sqrt(x*x + y*y + z*z) - 1.0; } TEST(ParallelMCTest, Sphere_Basic) { core::AABB3D bounds({-2, -2, -2}, {2, 2, 2}); ParallelMCConfig cfg{32}; auto mesh = parallel_marching_cubes(sphere_sdf, bounds, cfg); EXPECT_GT(mesh.num_vertices(), 0u); EXPECT_GT(mesh.num_faces(), 0u); } TEST(ParallelMCTest, Sphere_HighRes) { core::AABB3D bounds({-2, -2, -2}, {2, 2, 2}); ParallelMCConfig cfg{64}; auto mesh = parallel_marching_cubes(sphere_sdf, bounds, cfg); auto mesh_low = parallel_marching_cubes(sphere_sdf, bounds, ParallelMCConfig{16}); EXPECT_GT(mesh.num_faces(), mesh_low.num_faces()); } TEST(ParallelMCTest, EmptySpace) { core::AABB3D bounds({5, 5, 5}, {6, 6, 6}); ParallelMCConfig cfg{16}; auto mesh = parallel_marching_cubes(sphere_sdf, bounds, cfg); EXPECT_EQ(mesh.num_faces(), 0u); } TEST(ParallelMCTest, Adaptive_Sphere) { core::AABB3D bounds({-2, -2, -2}, {2, 2, 2}); ParallelMCConfig cfg{32, 0, true, 0.05, 3}; auto mesh = parallel_adaptive_mc(sphere_sdf, bounds, cfg); EXPECT_GT(mesh.num_vertices(), 0u); } TEST(ParallelMCTest, CustomThreadCount) { core::AABB3D bounds({-1.5, -1.5, -1.5}, {1.5, 1.5, 1.5}); ParallelMCConfig cfg{32, 2}; auto mesh = parallel_marching_cubes(sphere_sdf, bounds, cfg); EXPECT_GT(mesh.num_faces(), 0u); }