| 79 | } |
| 80 | |
| 81 | void init_BVH(py::module &m) { |
| 82 | py::class_<BVHEngine, std::shared_ptr<BVHEngine> >(m, "BVHEngine") |
| 83 | .def(py::init<>()) |
| 84 | .def_static("create", &BVHEngine::create) |
| 85 | .def_property_readonly_static("available_engines", |
| 86 | [](py::object){return BVHEngine::get_available_engines();}) |
| 87 | .def("set_mesh", &BVHEngine::set_mesh) |
| 88 | .def("build", &BVHEngine::build) |
| 89 | .def("lookup", |
| 90 | [](BVHEngine::Ptr tree, const MatrixFr& points) { |
| 91 | VectorF squared_dists; |
| 92 | VectorI closest_face_indices; |
| 93 | MatrixFr closest_points; |
| 94 | tree->lookup( |
| 95 | points, |
| 96 | squared_dists, |
| 97 | closest_face_indices, |
| 98 | closest_points); |
| 99 | return std::make_tuple( |
| 100 | squared_dists, |
| 101 | closest_face_indices, |
| 102 | closest_points); |
| 103 | }) |
| 104 | .def("lookup_signed", |
| 105 | [](BVHEngine::Ptr tree, const MatrixFr& points, |
| 106 | const MatrixFr& face_normals, |
| 107 | const MatrixFr& vertex_normals, |
| 108 | const MatrixFr& edge_normals, |
| 109 | const VectorI& edge_map) { |
| 110 | VectorF signed_dists; |
| 111 | VectorI closest_face_indices; |
| 112 | MatrixFr closest_points, closest_face_normals; |
| 113 | tree->lookup_signed( |
| 114 | points, |
| 115 | face_normals, |
| 116 | vertex_normals, |
| 117 | edge_normals, |
| 118 | edge_map, |
| 119 | signed_dists, |
| 120 | closest_face_indices, |
| 121 | closest_points, |
| 122 | closest_face_normals); |
| 123 | return std::make_tuple( |
| 124 | signed_dists, |
| 125 | closest_face_indices, |
| 126 | closest_points, |
| 127 | closest_face_normals); |
| 128 | }); |
| 129 | } |
no test coverage detected