Former-commit-id: 3ae8d0c1a97f0dd8363bee3824261e92a05c968b
@@ -1,10 +1,14 @@
from __future__ import print_function
+# Add the igl library to the modules search path
+import sys, os
+sys.path.insert(0, os.getcwd() + "/../")
+
import igl
# Load a mesh in OFF format
V = igl.eigen.MatrixXd()
F = igl.eigen.MatrixXi()
-igl.readOFF("../tutorial/shared/cube.off", V, F)
+igl.readOFF("../../tutorial/shared/cube.off", V, F)
# Print the vertices and faces matrices
print("Vertices: \n", V, sep='')
@@ -1,9 +1,13 @@
-igl.readOFF("../tutorial/shared/beetle.off", V, F)
+igl.readOFF("../../tutorial/shared/beetle.off", V, F)
# Plot the mesh
viewer = igl.viewer.Viewer();
@@ -1,3 +1,7 @@
V1 = igl.eigen.MatrixXd()
@@ -25,8 +29,8 @@ def key_pressed(viewer, key, modifier):
# Load two meshes
-igl.readOFF("../tutorial/shared/bumpy.off", V1, F1);
-igl.readOFF("../tutorial/shared/fertility.off", V2, F2);
+igl.readOFF("../../tutorial/shared/bumpy.off", V1, F1);
+igl.readOFF("../../tutorial/shared/fertility.off", V2, F2);
print("1 Switch to bump mesh")
print("2 Switch to fertility mesh")
@@ -5,7 +9,7 @@ F = igl.eigen.MatrixXi()
C = igl.eigen.MatrixXd()
-igl.readOFF("../tutorial/shared/screwdriver.off", V, F)
+igl.readOFF("../../tutorial/shared/screwdriver.off", V, F)
viewer = igl.viewer.Viewer()
-igl.readOFF("../tutorial/shared/bunny.off", V, F)
+igl.readOFF("../../tutorial/shared/bunny.off", V, F)
# Find the bounding box
m = V.colwiseMinCoeff()
@@ -1,5 +1,8 @@
-import igl
+import igl
@@ -22,7 +25,7 @@ def key_pressed(viewer, key, modifier):
return False
-igl.readOFF("../tutorial/shared/fandisk.off", V, F);
+igl.readOFF("../../tutorial/shared/fandisk.off", V, F);
# Compute per-face normals
N_faces = igl.eigen.MatrixXd()
# Load mesh
-igl.readOFF("../tutorial/shared/bumpy.off",V,F);
+igl.readOFF("../../tutorial/shared/bumpy.off",V,F);
# Compute Gaussian curvature
K = igl.eigen.MatrixXd();
@@ -1,8 +1,12 @@
V = igl.eigen.MatrixXd();
F = igl.eigen.MatrixXi();
-igl.read_triangle_mesh("../tutorial/shared/fertility.off", V, F);
+igl.read_triangle_mesh("../../tutorial/shared/fertility.off", V, F);
# Alternative discrete mean curvature
HN = igl.eigen.MatrixXd()
@@ -1,14 +1,18 @@
-igl.readOFF("../tutorial/shared/cheburashka.off", V, F)
+igl.readOFF("../../tutorial/shared/cheburashka.off", V, F)
# Read scalar function values from a file, U: #V by 1
U = igl.eigen.MatrixXd()
-igl.readDMAT("../tutorial/shared/cheburashka-scalar.dmat",U)
+igl.readDMAT("../../tutorial/shared/cheburashka-scalar.dmat",U)
U = U.col(0)
# Compute gradient operator: #F*3 by #V
@@ -1,4 +1,9 @@
import math
@@ -15,7 +20,7 @@ L = igl.eigen.SparseMatrixd()
-igl.readOFF("../tutorial/shared/cow.off", V, F)
+igl.readOFF("../../tutorial/shared/cow.off", V, F)
# Compute Laplace-Beltrami operator: #V by #V
igl.cotmatrix(V,F,L)
@@ -1,10 +1,15 @@
-igl.readOFF("../tutorial/shared/decimated-knight.off",V,F)
+igl.readOFF("../../tutorial/shared/decimated-knight.off",V,F)
# 100 random indicies into rows of F
I = igl.eigen.MatrixXi()
# Sort barycenters lexicographically
BC = igl.eigen.MatrixXd()
-igl.readOFF("../tutorial/shared/camelhead.off",V,F)
+igl.readOFF("../../tutorial/shared/camelhead.off",V,F)
# Find boundary edges
E = igl.eigen.MatrixXi()
-igl.readOFF("../tutorial/shared/cheburashka.off",V,F)
+igl.readOFF("../../tutorial/shared/cheburashka.off",V,F)
# Two fixed points
# Left hand, left foot
b = igl.eigen.MatrixXi()
@@ -43,7 +47,7 @@ def key_down(viewer, key, mod):
@@ -8,7 +12,7 @@ c = 0
bbd = 1.0
twod = False
-if not igl.read_triangle_mesh("../tutorial/shared/beetle.off",V,F):
+if not igl.read_triangle_mesh("../../tutorial/shared/beetle.off",V,F):
print("failed to load mesh")
twod = V.col(2).minCoeff() == V.col(2).maxCoeff()
@@ -32,7 +36,7 @@ viewer = igl.viewer.Viewer()
def key_down(viewer,key,mod):
global U, c
-
if key == ord(' '):
U = U.rightCols(k)
global bc_frac, bc_dir,deformation_field, V, U, V_bc, U_bc, F, b
@@ -47,12 +51,12 @@ def key_down(viewer, key, mods):
-igl.readOBJ("../tutorial/shared/decimated-max.obj",V,F)
+igl.readOBJ("../../tutorial/shared/decimated-max.obj",V,F)
U = igl.eigen.MatrixXd(V)
# S(i) = j: j<0 (vertex i not in handle), j >= 0 (vertex i in handle j)
S = igl.eigen.MatrixXd()
-igl.readDMAT("../tutorial/shared/decimated-max-selection.dmat",S)
+igl.readDMAT("../../tutorial/shared/decimated-max-selection.dmat",S)
S = S.castint()
global z_max, z_dir, k, resolve, V, U, Z, F, b, bc
@@ -43,17 +47,15 @@ def key_down(viewer, key, mods):
elif key == ord('.'):
k = k + 1
k = (4 if k>4 else k)
- print k
resolve = True
elif key == ord(','):
k = k - 1
k = (1 if k<1 else k)
return True
-igl.readOBJ("../tutorial/shared/bump-domain.obj",V,F)
+igl.readOBJ("../../tutorial/shared/bump-domain.obj",V,F)
# Find boundary vertices outside annulus
from math import sin,cos,pi
@@ -51,9 +55,9 @@ def key_down(viewer, key, mods):
-igl.readDMAT("../tutorial/shared/decimated-knight-selection.dmat",S)
+igl.readDMAT("../../tutorial/shared/decimated-knight-selection.dmat",S)
# Vertices in selection
@@ -17,7 +21,7 @@ def key_down(viewer, key, modifier):
-igl.readOFF("../tutorial/shared/camelhead.off", V, F)
+igl.readOFF("../../tutorial/shared/camelhead.off", V, F)
# Find the open boundary
bnd = igl.eigen.MatrixXi()
-igl.readOFF("../tutorial/shared/camelhead.off", V, F);
+igl.readOFF("../../tutorial/shared/camelhead.off", V, F);
# Fix two points on the boundary
@@ -27,7 +31,7 @@ def key_down(viewer, key, modifier):
# Compute the initial solution for ARAP (harmonic parametrization)