Python API¶
The wildmeshing package: the compiled bindings (wildmeshing._core, built from python/src)
and a pure-Python part (python/wildmeshing). Every function and class has a docstring:
help(wildmeshing.tetwild) lists the component's options. Installation
explains how to build it.
Components¶
One function per component, with two calls:
wm.<component>(options)- On files, as
wmtk_appruns the same options. ReturnsNone. wm.<component>(options, meshes) -> (outputs, report)- In memory.
meshesmaps names to mesh dictionaries, and the options name their inputs;outputsmaps names to mesh dictionaries (outputs["mesh"]is the result) andreportis a dictionary. Nothing is written.
| Function | Tutorial | Reference |
|---|---|---|
wm.shortest_edge_collapse |
tutorial | options |
wm.qslim |
tutorial | options |
wm.isotropic_remeshing |
tutorial | options |
wm.tetwild |
tutorial | options |
wm.triwild |
tutorial | options |
wm.simwild |
— | options |
wm.topological_offset |
tutorial | options |
wm.manifold_extraction |
tutorial | options |
wm.tracking |
tutorial | options |
wm.prismatic_mesh |
work in progress | options |
wm.c1_simplification |
work in progress | options |
wm.wildmeshing(options[, meshes])- The same, with the component named by
options["application"], as in awmtk_appfile. wm.components() -> list[str]- The components' names.
wm.spec(name) -> list[dict]- A component's spec: the rules of its options (pointer, type, default, doc, ...), from which its reference is generated.
An option a component does not have logs a warning, and has no effect (except in
topological_offset, which refuses it).
Meshes and files¶
Mesh dictionaries are described in Calling components.
wm.read_mesh(path) -> dict- Reads
.msh(Gmsh 4.1),.obj, and libigl's surface formats (.stl,.off,.ply, ...). wm.write_mesh(path, mesh)- Writes
.mshor.vtu. wm.save(outputs, stem),wm.load(stem) -> dict- A checkpoint of a memory result:
<stem>.msh, and<stem>_envelope.mshwhen the result has an envelope.loadreturns exactly the arrayssavewrote, in the same order, so a pipeline resumed from a checkpoint continues as it would have without one. wm.read_history(path) -> bytes,wm.write_history(path, history)- A history file (
history_output,volume_history_output) as the bytes a memory call returns in its report, and back.
Maps¶
Built from the history an application recorded; see the tracking tutorial.
wm.Tracking(history),wm.Tracking.load(path)- The map between a surface application's input and its output.
to_output(ids, bary)andto_input(ids, bary)map points given as faces (int64,(n,)) and barycentric coordinates (float64,(n, 3)), and return them on the other side,-1for a point with no image.input_faces,input_trianglesandoutput_trianglesname the faces of each side;build_warningscounts where the map is not a bijection. wm.CurveTracking(history),wm.CurveTracking.load(path)- The same for curves (TriWild): points on segments, with
feature_points. wm.VolumeTracking(...),wm.VolumeTracking.load(...)- The map of a tet mesh's volume, region by region, from the surface and volume histories that
TetWild and SimWild record with
volume_history_output.
Regions¶
wm.Expression(expr, known_names)- A parsed tag expression (names,
&,|,!, parentheses,_; see Concepts: regions).eval(tags)evaluates it on a set of tag names;has_unknown_names()is true when it names a tag outsideknown_names.
PolyFEM operations¶
wildmeshing.polyfem_ops runs PolyFEM-based operations on .msh files (install with
pip install "wildmeshing[polyfem]", and set POLYFEM_BIN): see
python/README.md.