Wildmeshing¶
Wildmeshing is a simple and robust 2d and 3d meshing package.
It can be easily install trough conda:
conda install wildmeshing
Documentation¶
It has 4 main functions:
tetrahedralize
triangulate
triangulate_data
triangulate_svg
and an unique import
import wildmeshing as wm
File based API¶
tetrahedralize
and triangulate
takes as input a path and write the output to a file using these parameters
input
: Input segments in .obj format (fortriangulate
) and input surface mesh in .off/.obj/.stl/.ply format (fortetrahedralize
).feature_input
default""
: Input feature json file (only fortriangulate
)output
, default""
: output path
triangulate_svg
reads an SVG and returns numpy
arrays:
svg_path
: Path for the input SVG file
Examples:¶
High-order triangulating an SVG:
V, F, nodes, F_nodes = wm.triangulate_svg("rocket.svg", cut_outside=True, hole_pts=[[255, 165]])
Tetrahedralizing an input triangle soup:
wm.tetrahedralize("small.stl", "out.msh")
numpy
based API¶
triangulate_data
uses numpy
arrays as input and output:
V
: Input verticesE
: Input edgesfeature_info
, defaultnone
: Json string containing the features
Examples:¶
Triangulating vertex and edges:
V = np.array([...])
L = np.array([...])
vs, tris, _, _ = wm.triangulate(V, L, cut_outside=True)
Common options¶
All function have a common list of parameters:
stop_quality
, default -1: Specify max AMIPS energy for stopping mesh optimizationmax_its
, default 80: Max number of mesh optimization iterationsstage
, default 1 in 2D and 2 in 3D: Specify envelope stageepsilon
, default -1: Relative envelope \(\epsilon_r\). Absolute \(\epsilon = \epsilon_r \cdot d\), where \(d\) is the diagonal of the bounding boxedge_length_r
, default 1/20: Relative target edge length \(\ell_r\). Absolute \(\ell=\ell_r \cdot d\), where \(d\) is the diagonal of the bounding boxmute_log
, default false: Mute prints
Triangulation¶
The 2D meshing supports high order, therefore it has these additional options:
feature_epsilon
, default 1e-3: Relative feature envelope mu_r. Absolute mu, default mu_r * diagonal_of_bbox (only fortriangulate
)flat_feature_angle
, default 10: Desired minimal anglecut_outside
, default false: Remove “outside part”skip_eps
, default false: Skip saving epshole_file
, default “”: Input a .xyz file for specifying points inside holes you want to remove
Tetrahedralization¶
Since it is more costly and complicated we have now a statefull version
tetra = wm.Tetrahedralizer(stop_quality=1000)
tetra.set_mesh(V, F)
tetra.tetrahedralize()
VT, TT = tetra.get_tet_mesh()