Merge branch 'python_bindings' of https://github.com/s-koch/libigl
# Conflicts: # python/CMakeLists.txt
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
//#include <Eigen/Geometry>
|
||||
//#include <Eigen/Dense>
|
||||
//#include <Eigen/Sparse>
|
||||
|
||||
|
||||
#include "../../python_shared.h"
|
||||
|
||||
#include <igl/copyleft/marching_cubes.h>
|
||||
#include <igl/copyleft/swept_volume.h>
|
||||
|
||||
|
||||
void python_export_igl_copyleft(py::module &me) {
|
||||
|
||||
py::module m = me.def_submodule(
|
||||
"copyleft", "Wrappers for libigl functions that are copyleft");
|
||||
|
||||
#include "../../py_igl/copyleft/py_marching_cubes.cpp"
|
||||
#include "../../py_igl/copyleft/py_swept_volume.cpp"
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "../python_shared.h"
|
||||
|
||||
#include <igl/embree/ambient_occlusion.h>
|
||||
#include <igl/embree/reorient_facets_raycast.h>
|
||||
|
||||
|
||||
void python_export_igl_embree(py::module &me) {
|
||||
@@ -14,5 +15,6 @@ void python_export_igl_embree(py::module &me) {
|
||||
"embree", "Wrappers for libigl functions that use embree");
|
||||
|
||||
#include "../py_igl/embree/py_ambient_occlusion.cpp"
|
||||
#include "../py_igl/embree/py_reorient_facets_raycast.cpp"
|
||||
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ py::class_<Type> bind_eigen_2(py::module &m, const char *name,
|
||||
.def("rowwiseMean", [](const Type &m) {return Type(m.rowwise().mean());} )
|
||||
.def("rowwiseNorm", [](const Type &m) {return Type(m.rowwise().norm());} )
|
||||
.def("rowwiseNormalized", [](const Type &m) {return Type(m.rowwise().normalized());} )
|
||||
.def("rowwiseReverse", [](const Type &m) {return Type(m.rowwise().reverse());} )
|
||||
.def("rowwiseMinCoeff", [](const Type &m) {return Type(m.rowwise().minCoeff());} )
|
||||
.def("rowwiseMaxCoeff", [](const Type &m) {return Type(m.rowwise().maxCoeff());} )
|
||||
|
||||
@@ -188,6 +189,8 @@ py::class_<Type> bind_eigen_2(py::module &m, const char *name,
|
||||
.def("colwiseProd", [](const Type &m) {return Type(m.colwise().prod());} )
|
||||
.def("colwiseMean", [](const Type &m) {return Type(m.colwise().mean());} )
|
||||
.def("colwiseNorm", [](const Type &m) {return Type(m.colwise().norm());} )
|
||||
.def("colwiseNormalized", [](const Type &m) {return Type(m.colwise().normalized());} )
|
||||
.def("colwiseReverse", [](const Type &m) {return Type(m.colwise().reverse());} )
|
||||
.def("colwiseMinCoeff", [](const Type &m) {return Type(m.colwise().minCoeff());} )
|
||||
.def("colwiseMaxCoeff", [](const Type &m) {return Type(m.colwise().maxCoeff());} )
|
||||
|
||||
@@ -689,6 +692,25 @@ void python_export_vector(py::module &m) {
|
||||
.def("solve",[](const Eigen::SimplicialLLT<Eigen::SparseMatrix<double > >& s, const Eigen::MatrixXd& rhs) { return Eigen::MatrixXd(s.solve(rhs)); })
|
||||
;
|
||||
|
||||
py::class_<Eigen::Affine3d > affine3d(me, "Affine3d");
|
||||
|
||||
affine3d
|
||||
.def(py::init<>())
|
||||
.def("setIdentity",[](Eigen::Affine3d& a){
|
||||
return a.setIdentity();
|
||||
})
|
||||
.def("rotate",[](Eigen::Affine3d& a, double angle, Eigen::MatrixXd axis) {
|
||||
assert_is_Vector3("axis", axis);
|
||||
return a.rotate(Eigen::AngleAxisd(angle, Eigen::Vector3d(axis)));
|
||||
})
|
||||
.def("translate",[](Eigen::Affine3d& a, Eigen::MatrixXd offset) {
|
||||
assert_is_Vector3("offset", offset);
|
||||
return a.translate(Eigen::Vector3d(offset));
|
||||
})
|
||||
.def("matrix", [](Eigen::Affine3d& a) -> Eigen::MatrixXd {
|
||||
return Eigen::MatrixXd(a.matrix());
|
||||
})
|
||||
;
|
||||
/* Bindings for Quaterniond*/
|
||||
//py::class_<Eigen::Quaterniond > quaterniond(me, "Quaterniond");
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user