Skip to content

Commit

Permalink
extend arap, and increase vnumber
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Aug 18, 2020
1 parent d209694 commit fdbbf2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions classes/classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace py = pybind11;
PYBIND11_MODULE(pyigl_classes, m)
{
py::class_<igl::ARAPData>(m, "ARAP")
.def(py::init([](Eigen::MatrixXd &v, Eigen::MatrixXi &f, int dim, Eigen::MatrixXi &b, const int energy_type) {
.def(py::init([](Eigen::MatrixXd &v, Eigen::MatrixXi &f, int dim, Eigen::MatrixXi &b,
const int energy_type, const bool with_dynamics, const double h, const double ym, const int max_iter) {
if (dim == 3)
{
assert_valid_tet_or_tri_mesh(v, f);
Expand All @@ -27,11 +28,15 @@ PYBIND11_MODULE(pyigl_classes, m)
}
if (energy_type >= igl::NUM_ARAP_ENERGY_TYPES)
{
throw pybind11::value_error("Invalid Energy Type. Must be one of igl.ARAP_ENERGY_TYPE_*");
throw pybind11::value_error("Invalid Energy Type. Must be one of igl.ARAP_ENERGY_TYPE_*");
}

std::unique_ptr<igl::ARAPData> adata = std::make_unique<igl::ARAPData>();
adata->energy = static_cast<igl::ARAPEnergyType>(energy_type);
adata->with_dynamics = with_dynamics;
adata->h = h;
adata->ym = ym;
adata->max_iter = max_iter;

if (b.cols() == 1)
igl::arap_precomputation(v, f, dim, b, *adata);
Expand All @@ -41,7 +46,7 @@ PYBIND11_MODULE(pyigl_classes, m)
throw pybind11::value_error("Invalid dimension for b, must be a vector, got " + std::to_string(b.rows()) + "x" + std::to_string(b.cols()));
return adata;
}),
py::arg("v"), py::arg("f"), py::arg("dim"), py::arg("b"), py::arg("energy_type") = 3)
py::arg("v"), py::arg("f"), py::arg("dim"), py::arg("b"), py::arg("energy_type") = 3, py::arg("with_dynamics") = false, py::arg("h") = 1, py::arg("ym") = 1, py::arg("max_iter") = 10)
.def(
"solve", [](igl::ARAPData &self, Eigen::MatrixXd &bc, Eigen::MatrixXd &initial_guess) {
if (bc.size() > 0)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def build_extension(self, ext):

setup(
name="igl",
version="2.2.0",
version="2.2.1",
author="libigl",
author_email="",
description="libigl Python Bindings",
Expand Down

0 comments on commit fdbbf2c

Please sign in to comment.