diff --git a/python/py_vector.cpp b/python/py_vector.cpp index a8829260a..27ab4d64e 100644 --- a/python/py_vector.cpp +++ b/python/py_vector.cpp @@ -173,6 +173,7 @@ py::class_ bind_eigen_2(py::module &m, const char *name, .def("cwiseQuotient", [](const Type &m1, const Type &m2) -> Type { return m1.cwiseQuotient(m2); }) /* Row and column-wise operations */ + .def("rowwiseSet", [](Type &m, const Type &m2) {return Type(m.rowwise() = Eigen::Matrix(m2));} ) .def("rowwiseSum", [](const Type &m) {return Type(m.rowwise().sum());} ) .def("rowwiseProd", [](const Type &m) {return Type(m.rowwise().prod());} ) .def("rowwiseMean", [](const Type &m) {return Type(m.rowwise().mean());} ) @@ -181,6 +182,7 @@ py::class_ bind_eigen_2(py::module &m, const char *name, .def("rowwiseMinCoeff", [](const Type &m) {return Type(m.rowwise().minCoeff());} ) .def("rowwiseMaxCoeff", [](const Type &m) {return Type(m.rowwise().maxCoeff());} ) + .def("colwiseSet", [](Type &m, const Type &m2) {return Type(m.colwise() = Eigen::Matrix(m2));} ) .def("colwiseSum", [](const Type &m) {return Type(m.colwise().sum());} ) .def("colwiseProd", [](const Type &m) {return Type(m.colwise().prod());} ) .def("colwiseMean", [](const Type &m) {return Type(m.colwise().mean());} ) diff --git a/python/tutorial/704_SignedDistance.py b/python/tutorial/704_SignedDistance.py index 431724054..265d05d77 100644 --- a/python/tutorial/704_SignedDistance.py +++ b/python/tutorial/704_SignedDistance.py @@ -32,11 +32,13 @@ viewer = igl.viewer.Viewer() def append_mesh(C_vis, F_vis, V_vis, V, F, color): F_vis.conservativeResize(F_vis.rows() + F.rows(), 3) - # F_vis.setBottomRows(F.rows(), F + V_vis.rows()) + F_vis.setBottomRows(F.rows(), F + V_vis.rows()) V_vis.conservativeResize(V_vis.rows() + V.rows(), 3) - # V_vis.setBottomRows(V.rows(), V) + V_vis.setBottomRows(V.rows(), V) C_vis.conservativeResize(C_vis.rows() + V.rows(), 3) - # C_vis.setBottomRows(V.rows(), color) + colorM = igl.eigen.MatrixXd(V.rows(), C_vis.cols()) + colorM.rowwiseSet(color) + C_vis.setBottomRows(V.rows(), colorM) def update_visualization(viewer):