Restructuring Python bindings, moved submodules and dependencies to own folders, added dependency checking for some tutorials, minor refactorings

Former-commit-id: 2214125878
This commit is contained in:
Sebastian Koch
2016-06-07 15:13:54 +02:00
parent 2a11d6243a
commit ad00bd397f
22 changed files with 198 additions and 63 deletions
+3 -2
View File
@@ -1,10 +1,11 @@
from __future__ import print_function
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
# Load a mesh in OFF format
V = igl.eigen.MatrixXd()
F = igl.eigen.MatrixXi()
+11 -6
View File
@@ -1,15 +1,20 @@
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
from shared import TUTORIAL_SHARED_PATH, check_dependencies
dependencies = ["viewer"]
check_dependencies(dependencies)
# Load a mesh in OFF format
V = igl.eigen.MatrixXd()
F = igl.eigen.MatrixXi()
igl.readOFF("../../tutorial/shared/beetle.off", V, F)
igl.readOFF(TUTORIAL_SHARED_PATH + "beetle.off", V, F)
# Plot the mesh
viewer = igl.viewer.Viewer();
viewer.data.set_mesh(V, F);
viewer.launch();
viewer = igl.viewer.Viewer()
viewer.data.set_mesh(V, F)
viewer.launch()
+10 -4
View File
@@ -1,11 +1,17 @@
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
import random
from math import cos,sin,pi
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
from shared import TUTORIAL_SHARED_PATH, check_dependencies
dependencies = ["embree", "viewer"]
check_dependencies(dependencies)
# Input mesh
V = igl.eigen.MatrixXd()
F = igl.eigen.MatrixXi()
+10 -6
View File
@@ -1,13 +1,17 @@
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
import random
from math import cos, sin, pi
TUTORIAL_SHARED_PATH = "../../tutorial/shared/"
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
from shared import TUTORIAL_SHARED_PATH, check_dependencies
dependencies = ["viewer"]
check_dependencies(dependencies)
viewer = igl.viewer.Viewer()
+8 -3
View File
@@ -1,9 +1,14 @@
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
from shared import check_dependencies
dependencies = ["triangle", "viewer"]
check_dependencies(dependencies)
# Input polygon
V = igl.eigen.MatrixXd([[-1, -1], [1, -1], [1, 1], [-1, 1], [-2, -2], [2, -2], [2, 2], [-2, 2]])
E = igl.eigen.MatrixXi([[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6,7], [7,4]])
@@ -13,7 +18,7 @@ H = igl.eigen.MatrixXd([[0, 0]])
V2 = igl.eigen.MatrixXd()
F2 = igl.eigen.MatrixXi()
igl.triangle_triangulate(V, E, H, "a0.005q", V2, F2)
igl.triangle.triangulate(V, E, H, "a0.005q", V2, F2)
# Plot the mesh
viewer = igl.viewer.Viewer()
+7 -4
View File
@@ -1,10 +1,13 @@
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
TUTORIAL_SHARED_PATH = "../../tutorial/shared/"
from shared import TUTORIAL_SHARED_PATH, check_dependencies
dependencies = ["tetgen", "viewer"]
check_dependencies(dependencies)
# Input polygon
@@ -60,7 +63,7 @@ def key_down(viewer, key, modifier):
igl.readOFF(TUTORIAL_SHARED_PATH + "fertility.off", V, F)
# Tetrahedralize the interior
igl.copyleft_tetgen_tetrahedralize(V, F, "pq1.414Y", TV, TT, TF)
igl.tetgen.tetrahedralize(V, F, "pq1.414Y", TV, TT, TF)
# Compute barycenters
igl.barycenter(TV, TT, B)
+6 -5
View File
@@ -1,13 +1,14 @@
# Add the igl library to the modules search path
import sys, os
import math
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
TUTORIAL_SHARED_PATH = "../../tutorial/shared/"
from shared import TUTORIAL_SHARED_PATH, check_dependencies
dependencies = ["embree", "viewer"]
check_dependencies(dependencies)
# Mesh + AO values + Normals
@@ -53,7 +54,7 @@ igl.readOFF(TUTORIAL_SHARED_PATH + "fertility.off", V, F)
igl.per_vertex_normals(V, F, N)
# Compute ambient occlusion factor using embree
igl.embree_ambient_occlusion(V, F, V, N, 500, AO)
igl.embree.ambient_occlusion(V, F, V, N, 500, AO)
AO = 1.0 - AO
# Plot the generated mesh
+7 -3
View File
@@ -1,10 +1,14 @@
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
TUTORIAL_SHARED_PATH = "../../tutorial/shared/"
from shared import TUTORIAL_SHARED_PATH, check_dependencies
dependencies = ["viewer"]
check_dependencies(dependencies)
# Mesh with per-face color
+11 -9
View File
@@ -1,15 +1,17 @@
from __future__ import print_function
# Add the igl library to the modules search path
import sys, os
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
from iglhelpers import e2p
import math
TUTORIAL_SHARED_PATH = "../../tutorial/shared/"
# Add the igl library to the modules search path
sys.path.insert(0, os.getcwd() + "/../")
import pyigl as igl
from iglhelpers import e2p
from shared import TUTORIAL_SHARED_PATH, check_dependencies
dependencies = ["viewer"]
check_dependencies(dependencies)
global V, F, T, tree, FN, VN, EN, E, EMAP, max_distance, slice_z, overlay
+16
View File
@@ -0,0 +1,16 @@
import pyigl as igl
import sys
TUTORIAL_SHARED_PATH = "../../tutorial/shared/"
def check_dependencies(deps):
available = [hasattr(igl, m) for m in deps]
all_available = True
for i, d in enumerate(available):
if not d:
all_available = False
print("The libigl python bindings were compiled without %s support. Please recompile with the CMAKE flag LIBIGL_WITH_%s." %(deps[i], deps[i].upper()))
if not all_available:
sys.exit(-1)