18#include <lagrange/Mesh.h>
19#include <lagrange/bvh/AABBIGL.h>
20#include <lagrange/bvh/BVH.h>
21#include <lagrange/bvh/BVHNanoflann.h>
22#include <lagrange/bvh/BVHType.h>
33template <
typename VertexArray,
typename ElementArray = lagrange::Triangles>
34std::unique_ptr<BVH<VertexArray, ElementArray>> create_BVH(
35 const BVHType engine_type,
36 const Eigen::MatrixBase<VertexArray>& vertices)
38 switch (engine_type) {
39 case BVHType::NANOFLANN: {
40 using BVH_t = BVHNanoflann<VertexArray, ElementArray>;
41 auto engine = std::make_unique<BVH_t>();
42 engine->build(vertices);
46 throw std::runtime_error(
"Unsupported BVH engine type: " + bvhtype_to_string(engine_type));
56template <
typename VertexArray,
typename ElementArray>
57std::unique_ptr<BVH<VertexArray, ElementArray>> create_BVH(
58 const BVHType engine_type,
59 const Eigen::MatrixBase<VertexArray>& vertices,
60 const Eigen::MatrixBase<ElementArray>& elements)
62 switch (engine_type) {
63 case BVHType::NANOFLANN: {
64 using BVH_t = BVHNanoflann<VertexArray, ElementArray>;
65 auto engine = std::make_unique<BVH_t>();
66 engine->build(vertices);
70 using BVH_t = AABBIGL<VertexArray, ElementArray>;
71 auto engine = std::make_unique<BVH_t>();
72 engine->build(vertices, elements);
76 throw std::runtime_error(
"Unsupported BVH engine: " + bvhtype_to_string(engine_type));
89template <
typename VertexArray,
typename ElementArray>
90std::unique_ptr<BVH<VertexArray, ElementArray>> create_BVH(
91 const BVHType engine_type,
94 switch (engine_type) {
95 case BVHType::NANOFLANN: {
96 using BVH_t = BVHNanoflann<VertexArray, ElementArray>;
97 auto engine = std::make_unique<BVH_t>();
98 engine->build(mesh.get_vertices());
102 using BVH_t = AABBIGL<VertexArray, ElementArray>;
103 auto engine = std::make_unique<BVH_t>();
104 engine->build(mesh.get_vertices(), mesh.get_facets());
108 throw std::runtime_error(
"Unsupported BVH engine: " + bvhtype_to_string(engine_type));
Main namespace for Lagrange.
Definition: AABBIGL.h:30