-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
225 changed files
with
3,413 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <igl/AABB.h> | ||
#include <npe.h> | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
#include <variant> | ||
#include <variant> | ||
|
||
|
||
namespace py = pybind11; | ||
template <int DIM> | ||
void init_AABB(py::module_ &m) | ||
{ | ||
using AABB_f64_DIM = igl::AABB<Eigen::MatrixXd,DIM>; | ||
py::class_<AABB_f64_DIM >(m, (std::string("AABB_f64_")+std::to_string(DIM)).c_str() ) | ||
.def(py::init([]() | ||
{ | ||
std::unique_ptr<AABB_f64_DIM> self = std::make_unique<AABB_f64_DIM>(); | ||
return self; | ||
})) | ||
.def("init",[](AABB_f64_DIM & self, const Eigen::MatrixXd & V, const Eigen::MatrixXi & F) | ||
{ | ||
self.init(V,F); | ||
}, | ||
py::arg("V"), py::arg("F")) | ||
.def("squared_distance",[]( | ||
AABB_f64_DIM & self, | ||
const Eigen::MatrixXd & V, | ||
const Eigen::MatrixXi & F, | ||
const Eigen::MatrixXd & P, | ||
const bool return_index = false, | ||
const bool return_closest_point = false) -> | ||
std::variant<py::object,std::list<py::object> > | ||
{ | ||
Eigen::VectorXd sqrD; | ||
Eigen::VectorXi I; | ||
Eigen::MatrixXd C; | ||
self.squared_distance(V,F,P,sqrD,I,C); | ||
if(return_index && return_closest_point) | ||
{ | ||
return std::list<py::object>({npe::move(sqrD),npe::move(I),npe::move(C)}); | ||
}else if(return_index) | ||
{ | ||
return std::list<py::object>({npe::move(sqrD),npe::move(I)}); | ||
}else if(return_closest_point) | ||
{ | ||
return std::list<py::object>({npe::move(sqrD),npe::move(C)}); | ||
}else | ||
{ | ||
return npe::move(sqrD); | ||
} | ||
}, | ||
py::arg("V"), | ||
py::arg("F"), | ||
py::arg("P"), | ||
py::arg("return_index")=false, | ||
py::arg("return_closest_point")=false | ||
) | ||
; | ||
} | ||
|
||
template void init_AABB<2>(py::module_ &); | ||
template void init_AABB<3>(py::module_ &); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
__version__ = "2.5.2dev" | ||
# This file is part of libigl, a simple c++ geometry processing library. | ||
# | ||
# Copyright (C) 2023 Alec Jacobson | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public License | ||
# v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
# obtain one at http://mozilla.org/MPL/2.0/. | ||
__version__ = "2.5.4dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.