simIGL Plugin API reference

Wrapper for libigl

simIGL.barycenter
simIGL.centroid
simIGL.closestFacet
simIGL.convexHull
simIGL.convexHullShape
simIGL.exactGeodesic
simIGL.getMesh
simIGL.intersectWithHalfSpace
simIGL.meshBoolean
simIGL.meshBooleanShape
simIGL.randomPointsOnMesh
simIGL.sweptVolume
simIGL.tetrahedralize
simIGL.uniqueEdgeMap
simIGL.upsample
simIGL.volume

simIGL.barycenter

Description Computes the barycenter of every simplex.
Lua synopsis grid bc=simIGL.barycenter(grid v, grid f)
Lua parameters
v (grid): vertex position list
f (grid): indices of simplex corners into V
Lua return values
bc (grid): matrix of vertices
Python synopsis grid bc=simIGL.barycenter(grid v, grid f)
See also

simIGL.centroid

Description Computes the centroid of a closed mesh using a surface integral.
Lua synopsis float[3] c, float vol=simIGL.centroid(mesh m)
Lua parameters
m (mesh): mesh
Lua return values
c (table of float, size 3): vector of centroid coordinates
vol (float): total volume of solid
Python synopsis list c, float vol=simIGL.centroid(mesh m)
See also

simIGL.closestFacet

Description Determine the closest facet for each of the input points.
Lua synopsis int[] r, int[] s=simIGL.closestFacet(mesh m, grid points, grid emap, grid uec, grid uee, int[] indices={})
Lua parameters
m (mesh): mesh
points (grid): query points
emap (grid): list of indices into uE, mapping each directed edge to unique undirected edge so that uE(EMAP(f+#F*c)) is the unique edge corresponding to E.row(f+#F*c)
uec (grid): list of cumulative counts of directed edges sharing each unique edge so the uEC(i+1)-uEC(i) is the number of directed edges sharing the ith unique edge
uee (grid): list of indices into E, so that the consecutive segment of indices uEE.segment(uEC(i),uEC(i+1)-uEC(i)) lists all directed edges sharing the ith unique edge
indices (table of int, default: {}): indices of faces to consider, or empty for all
Lua return values
r (table of int): list of closest face indices, same size as p
s (table of int): list of bools indicating on which side of the facet each query point lies, same size as p
Python synopsis list r, list s=simIGL.closestFacet(mesh m, grid points, grid emap, grid uec, grid uee, list indices={})
See also

simIGL.convexHull

Description Given a set of points, compute the convex hull as a triangle mesh.
Lua synopsis mesh m=simIGL.convexHull(float[] points)
Lua parameters
points (table of float): mesh
Lua return values
m (mesh): mesh
Python synopsis mesh m=simIGL.convexHull(list points)
See also

simIGL.convexHullShape

Description convenience wrapper for simIGL.convexHull to operate on shapes directly
Lua synopsis int handleResult=simIGL.convexHullShape(int[] handles)
Lua parameters
handles (table of int): the handle of the input shapes
Lua return values
handleResult (int): the handle of the resulting shape
Python synopsis int handleResult=simIGL.convexHullShape(list handles)
See also

simIGL.exactGeodesic

Description The discrete geodesic distance between two points is the length of the shortest path between then restricted to the surface. For triangle meshes, such a path is made of a set of segments which can be either edges of the mesh or crossing a triangle.
Lua synopsis float[] distances=simIGL.exactGeodesic(mesh m, int[] vs, int[] fs, int[] vt, int[] ft)
Lua parameters
m (mesh): mesh
vs (table of int): indices of source vertices
fs (table of int): indices of source faces
vt (table of int): indices of target vertices
ft (table of int): indices of target faces
Lua return values
distances (table of float): output vector which lists first the distances for the target vertices, and then for the target faces
Python synopsis list distances=simIGL.exactGeodesic(mesh m, list vs, list fs, list vt, list ft)
See also

simIGL.getMesh

Description get mesh data of a given shape in the format used by simIGL functions
Lua synopsis table mesh=simIGL.getMesh(int h, table options={})
Lua parameters
h (int): the handle of the shape
options (table, default: {}): options
Lua return values
mesh (table): mesh object
Python synopsis list mesh=simIGL.getMesh(int h, list options={})
See also

simIGL.intersectWithHalfSpace

Description Intersect a PWN mesh with a half-space. Point on plane, normal pointing outward.
Lua synopsis mesh m, int[] j=simIGL.intersectWithHalfSpace(mesh m, float[3] pt, float[3] n)
Lua parameters
m (mesh): mesh
pt (table of float, size 3): point on plane
n (table of float, size 3): normal of plane pointing away from inside
Lua return values
m (mesh): result mesh
j (table of int): list of indices into [F;F.rows()+[1;2]] revealing "birth" facet
Python synopsis mesh m, list j=simIGL.intersectWithHalfSpace(mesh m, list pt, list n)
See also

simIGL.meshBoolean

Description Compute several boolean operations on the meshes specified by vertices and (triangle) indices
Lua synopsis mesh result=simIGL.meshBoolean(mesh a, mesh b, int op)
Lua parameters
a (mesh): first mesh
b (mesh): second mesh
op (int): operation, see simIGL.boolean_op
Lua return values
result (mesh): resulting mesh
Python synopsis mesh result=simIGL.meshBoolean(mesh a, mesh b, int op)
See also

simIGL.meshBooleanShape

Description convenience wrapper for simIGL.meshBoolean to operate on shapes directly
Lua synopsis int handleResult=simIGL.meshBooleanShape(int[] handles, int op)
Lua parameters
handles (table of int): the handle of the input shapes
op (int): the operation (see simIGL.boolean_op)
Lua return values
handleResult (int): the handle of the resulting shape
Python synopsis int handleResult=simIGL.meshBooleanShape(list handles, int op)
See also

simIGL.randomPointsOnMesh

Description Randomly sample a mesh n times
Lua synopsis grid b, grid fi=simIGL.randomPointsOnMesh(int n, mesh m, bool convertToWorldCoords=false)
Lua parameters
n (int): num samples
m (mesh): mesh
convertToWorldCoords (bool, default: false): if true, output will be in world coords and not in barycentric coords
Lua return values
b (grid): list of barycentric/world coordinates, ith row are coordinates of ith sampled point in face FI[i]
fi (grid): list of indices into F
Python synopsis grid b, grid fi=simIGL.randomPointsOnMesh(int n, mesh m, bool convertToWorldCoords=false)
See also

simIGL.sweptVolume

Description Generate a volume-sweep mesh
Lua synopsis mesh m=simIGL.sweptVolume(mesh m, string transformFunc, int timeSteps, int gridSize, float isoLevel=0)
Lua parameters
m (mesh): mesh
transformFunc (string): rigid transform as a function of time (0..1); must return a 4x4 transform matrix as 12/16 values
timeSteps (int): number of time steps
gridSize (int): size of voxel grid internally used for mesh generation
isoLevel (float, default: 0): can be set to zero to approximate the exact swept volume, greater than zero to approximate a positive offset of the swept volume or less than zero to approximate a negative offset
Lua return values
m (mesh): volume-sweep mesh
Python synopsis mesh m=simIGL.sweptVolume(mesh m, string transformFunc, int timeSteps, int gridSize, float isoLevel=0)
See also

simIGL.tetrahedralize

Description Mesh the interior of a surface mesh using tetgen.
Lua synopsis int result, grid tv, grid tt, grid tf=simIGL.tetrahedralize(mesh m, string switches="")
Lua parameters
m (mesh): mesh
switches (string, default: ""): string of tetgen options (See tetgen documentation) e.g. "pq1.414a0.01" tries to mesh the interior of a given surface with quality and area constraints; "" will mesh the convex hull constrained to pass through V (ignores F)
Lua return values
result (int): Returns status: 0 success; 1 tetgen threw exception; 2 tetgen did not crash but could not create any tets (probably there are holes, duplicate faces etc.); -1 other error
tv (grid): vertex position list
tt (grid): list of tet face indices
tf (grid): list of triangle face indices
Python synopsis int result, grid tv, grid tt, grid tf=simIGL.tetrahedralize(mesh m, string switches="")
See also

simIGL.uniqueEdgeMap

Description Construct relationships between facet "half"-(or rather "viewed")-edges E to unique edges of the mesh seen as a graph.
Lua synopsis grid e, grid ue, grid emap, grid uec, grid uee=simIGL.uniqueEdgeMap(grid f)
Lua parameters
f (grid): list of simplices
Lua return values
e (grid): list of all directed edges, such that E.row(f+#F*c) is the edge opposite F(f,c)
ue (grid): list of unique undirected edges
emap (grid): list of indices into uE, mapping each directed edge to unique undirected edge so that uE(EMAP(f+#F*c)) is the unique edge corresponding to E.row(f+#F*c)
uec (grid): list of cumulative counts of directed edges sharing each unique edge so the uEC(i+1)-uEC(i) is the number of directed edges sharing the ith unique edge
uee (grid): list of indices into E, so that the consecutive segment of indices uEE.segment(uEC(i),uEC(i+1)-uEC(i)) lists all directed edges sharing the ith unique edge
Python synopsis grid e, grid ue, grid emap, grid uec, grid uee=simIGL.uniqueEdgeMap(grid f)
See also

simIGL.upsample

Description Subdivide a mesh without moving vertices: loop subdivision but odd vertices stay put and even vertices are just edge midpoints.
Lua synopsis mesh m=simIGL.upsample(mesh m, int n=1)
Lua parameters
m (mesh): mesh
n (int, default: 1): number of subdivisions
Lua return values
m (mesh): subdivided mesh
Python synopsis mesh m=simIGL.upsample(mesh m, int n=1)
See also

simIGL.volume

Description Compute volume for all tets of a given tet mesh.
Lua synopsis float[] vol=simIGL.volume(tetmesh m)
Lua parameters
m (tetmesh): tet mesh
Lua return values
vol (table of float): list of tetrahedron volumes
Python synopsis list vol=simIGL.volume(tetmesh m)
See also



Constants

Constants used in the various functions. Refer to each constant using enumName.constantName, i.e. simUI.curve_type.xy for xy constant in simUI.curve_type enum.

simIGL.boolean_op

union
intersection
difference
symmetric_difference
resolve


Data structures

Data structures are used to pass complex data around. Create data structures in Lua in the form of a map, e.g.: {line_size=3, add_to_legend=false, selectable=true}

mesh

Description
Fields
vertices (table of float): vertices of the mesh (3 * n values)
indices (table of int): triangle indices of the mesh (3 * m indices, zero-based)
normals (table of float): per-vertex normals (3 * n values)
See also

tetmesh

Description
Fields
vertices (table of float): vertices of the mesh (3 * n values)
indices (table of int): tetrahedra indices of the mesh (4 * m indices, zero-based)
See also



Script functions

Script functions are used to call some lua code from the plugin side (tipically used for event handlers).

transformCallback

Description Callback used by simIGL.sweptVolume.
Lua synopsis float[] transform=simIGL.transformCallback(float t)
Lua parameters
t (float): time parameter in 0..1 range
Lua return values
transform (table of float): a 4x4 transform matrix as 12/16 values
Python synopsis list transform=simIGL.transformCallback(float t)
See also