fixed bug in nrosy wrapper
This commit is contained in:
@@ -75,7 +75,7 @@ def plot_mesh_nrosy(viewer, V, F, N, PD1, S, b):
|
||||
def key_down(viewer, key, modifier):
|
||||
global N
|
||||
if key >= ord('1') and key <= ord('9'):
|
||||
N = key - '0'
|
||||
N = key - ord('0')
|
||||
|
||||
R = igl.eigen.MatrixXd()
|
||||
S = igl.eigen.MatrixXd()
|
||||
@@ -95,7 +95,7 @@ bc = igl.eigen.MatrixXd([[1,1,1]])
|
||||
viewer = igl.viewer.Viewer()
|
||||
|
||||
# Interpolate the field and plot
|
||||
key_down(viewer, '4', 0)
|
||||
key_down(viewer, ord('4'), 0)
|
||||
|
||||
# Plot the mesh
|
||||
viewer.data.set_mesh(V, F)
|
||||
|
||||
+26
-2
@@ -26,8 +26,8 @@ find_package(OPENGL REQUIRED)
|
||||
# SET(PYTHON_INCLUDE_DIR "D:/Python34/include")
|
||||
|
||||
# Force a specific python version
|
||||
# SET(PYTHON_LIBRARIES "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5m.dylib")
|
||||
# SET(PYTHON_INCLUDE_DIR "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/include/python3.5m")
|
||||
SET(PYTHON_LIBRARIES "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5m.dylib")
|
||||
SET(PYTHON_INCLUDE_DIR "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/include/python3.5m")
|
||||
|
||||
set(Python_ADDITIONAL_VERSIONS 3.4.3 3.5 3.6)
|
||||
find_package(PythonLibs REQUIRED)
|
||||
@@ -78,6 +78,30 @@ include_directories("../external/nanogui/ext/glfw/include")
|
||||
include_directories("../external/nanogui/ext/nanovg/src")
|
||||
list(APPEND SHARED_LIBRARIES "nanogui" "glfw" ${OPENGL_LIBRARIES})
|
||||
|
||||
# include comiso if available
|
||||
|
||||
find_package(LIBCOMISOH QUIET)
|
||||
#Compile CoMISo (if found)
|
||||
# NOTE: this cmakefile works only with the
|
||||
# comiso available here: https://github.com/libigl/CoMISo
|
||||
IF(LIBCOMISO_FOUND)
|
||||
|
||||
add_definitions(-DPY_COMISO)
|
||||
|
||||
include_directories("../../CoMISo/ext/gmm-4.2/include")
|
||||
include_directories("../../")
|
||||
add_subdirectory("../../CoMISo/" "CoMISo")
|
||||
|
||||
list(APPEND SHARED_SOURCES "py_igl_comiso.cpp")
|
||||
|
||||
if(APPLE)
|
||||
find_library(accelerate_library Accelerate)
|
||||
list(APPEND SHARED_LIBRARIES "CoMISo" ${accelerate_library})
|
||||
else(APPLE) #APPLE
|
||||
list(APPEND SHARED_LIBRARIES "CoMISo")
|
||||
endif(APPLE)
|
||||
|
||||
ENDIF(LIBCOMISO_FOUND)
|
||||
|
||||
add_library(igl SHARED
|
||||
python.cpp
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
#include <igl/map_vertices_to_circle.h>
|
||||
#include <igl/lscm.h>
|
||||
#include <igl/local_basis.h>
|
||||
#include <igl/rotate_vectors.h>
|
||||
#include <igl/compute_frame_field_bisectors.h>
|
||||
#include <igl/comb_cross_field.h>
|
||||
#include <igl/cross_field_missmatch.h>
|
||||
#include <igl/find_cross_field_singularities.h>
|
||||
#include <igl/cut_mesh_from_singularities.h>
|
||||
#include <igl/comb_frame_field.h>
|
||||
|
||||
|
||||
void python_export_igl(py::module &m)
|
||||
{
|
||||
@@ -81,4 +89,12 @@ void python_export_igl(py::module &m)
|
||||
#include "py_igl/py_map_vertices_to_circle.cpp"
|
||||
#include "py_igl/py_lscm.cpp"
|
||||
#include "py_igl/py_local_basis.cpp"
|
||||
#include "py_igl/py_rotate_vectors.cpp"
|
||||
#include "py_igl/py_compute_frame_field_bisectors.cpp"
|
||||
#include "py_igl/py_comb_cross_field.cpp"
|
||||
#include "py_igl/py_cross_field_missmatch.cpp"
|
||||
#include "py_igl/py_find_cross_field_singularities.cpp"
|
||||
#include "py_igl/py_cut_mesh_from_singularities.cpp"
|
||||
#include "py_igl/py_comb_frame_field.cpp"
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,23 @@ m.def("nrosy", []
|
||||
assert_is_VectorX("b",b);
|
||||
assert_is_VectorX("b_soft",b_soft);
|
||||
assert_is_VectorX("w_soft",w_soft);
|
||||
|
||||
Eigen::VectorXi bt;
|
||||
if (b.size() != 0)
|
||||
bt = b;
|
||||
|
||||
Eigen::VectorXi b_softt;
|
||||
if (b_soft.size() != 0)
|
||||
b_softt = b_soft;
|
||||
|
||||
Eigen::VectorXd w_softt;
|
||||
if (w_soft.size() != 0)
|
||||
w_softt = w_soft;
|
||||
|
||||
Eigen::VectorXd St;
|
||||
igl::comiso::nrosy(V,F,b,bc,b_soft,w_soft,bc_soft,N,soft,R,St);
|
||||
igl::comiso::nrosy(V,F,bt,bc,b_softt,w_softt,bc_soft,N,soft,R,St);
|
||||
S = St;
|
||||
|
||||
}, __doc_igl_comiso_nrosy,
|
||||
py::arg("V"), py::arg("F"), py::arg("b"), py::arg("bc"), py::arg("b_soft"), py::arg("w_soft"), py::arg("bc_soft"), py::arg("N"), py::arg("soft"), py::arg("R"), py::arg("S"));
|
||||
|
||||
@@ -34,8 +48,13 @@ m.def("nrosy", []
|
||||
)
|
||||
{
|
||||
assert_is_VectorX("b",b);
|
||||
|
||||
Eigen::VectorXi bt;
|
||||
if (b.size() != 0)
|
||||
bt = b;
|
||||
|
||||
Eigen::VectorXd St;
|
||||
igl::comiso::nrosy(V,F,b,bc,N,R,St);
|
||||
igl::comiso::nrosy(V,F,bt,bc,N,R,St);
|
||||
S = St;
|
||||
}, __doc_igl_comiso_nrosy,
|
||||
py::arg("V"), py::arg("F"), py::arg("b"), py::arg("bc"), py::arg("N"), py::arg("R"), py::arg("S"));
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <Eigen/Geometry>
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/Sparse>
|
||||
|
||||
|
||||
#include "python.h"
|
||||
|
||||
#include <igl/comiso/nrosy.h>
|
||||
#include <igl/comiso/miq.h>
|
||||
|
||||
void python_export_igl_comiso(py::module &me) {
|
||||
|
||||
py::module m = me.def_submodule(
|
||||
"comiso", "Wrappers for libigl functions that use comiso");
|
||||
|
||||
#include "py_igl/comiso/py_nrosy.cpp"
|
||||
#include "py_igl/comiso/py_miq.cpp"
|
||||
|
||||
}
|
||||
@@ -7,6 +7,10 @@ extern void python_export_vector(py::module &);
|
||||
extern void python_export_igl(py::module &);
|
||||
extern void python_export_igl_viewer(py::module &);
|
||||
|
||||
#ifdef PY_COMISO
|
||||
extern void python_export_igl_comiso(py::module &);
|
||||
#endif
|
||||
|
||||
PYTHON_PLUGIN(igl) {
|
||||
py::init_threading();
|
||||
py::module m("igl", "Python wrappers for libigl");
|
||||
@@ -15,5 +19,9 @@ PYTHON_PLUGIN(igl) {
|
||||
python_export_igl(m);
|
||||
python_export_igl_viewer(m);
|
||||
|
||||
#ifdef PY_COMISO
|
||||
python_export_igl_comiso(m);
|
||||
#endif
|
||||
|
||||
return m.ptr();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user