MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / create

Method create

tools/BVH/BVHEngine.cpp:17–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using namespace PyMesh;
16
17BVHEngine::Ptr BVHEngine::create(const std::string& engine_name, size_t dim) {
18 if (engine_name == "auto") {
19#if WITH_IGL
20 return BVHEngine::create("igl", dim);
21#elif WITH_CGAL
22 if (dim == 3) return BVHEngine::create("cgal", dim);
23#elif WITH_GEOGRAM
24 if (dim == 3) return BVHEngine::create("geogram", dim);
25#endif
26 }
27
28#if WITH_CGAL
29 if (engine_name == "cgal") {
30 if (dim != 3) {
31 throw NotImplementedError(
32 "Only 3D meshes are supported by CGAL BVH");
33 }
34 return std::make_shared<_CGAL::AABBTree>();
35 }
36#endif
37#if WITH_GEOGRAM
38 if (engine_name == "geogram") {
39 if (dim != 3) {
40 throw NotImplementedError(
41 "Only 3D meshes are supported by Geogram BVH");
42 }
43 return std::make_shared<Geogram::AABBTree>();
44 }
45#endif
46#if WITH_IGL
47 if (engine_name == "igl") {
48 switch (dim) {
49 case 2:
50 return std::make_shared<IGL::AABBTree<2>>();
51 case 3:
52 return std::make_shared<IGL::AABBTree<3>>();
53 default:
54 throw NotImplementedError("Only 2D and 3D meshes are supported");
55 }
56 }
57#endif
58 throw NotImplementedError("BVH Engine (" + engine_name
59 + ") is not supported.");
60}
61
62std::vector<std::string> BVHEngine::get_available_engines() {
63 std::vector<std::string> engine_names;

Callers 1

geomesh_to_meshMethod · 0.45

Calls 1

NotImplementedErrorClass · 0.85

Tested by

no test coverage detected