Skip to content

Wildmeshing tutorial

This is a jupyter notebook. The “real” notebook can be found here.

To use it just import it!

import wildmeshing as wm

We also import meshplot to visualize

import meshplot as mp

Triangulation

The 2D meshing supports high order

V, F, nodes, F_nodes = wm.triangulate_svg("rocket.svg")
1/3 n sub paths: 18
2/3 n sub paths: 5
3/3 n sub paths: 12

Plot the resulting mesh

mp.plot(V, F, shading={"wireframe": True})

The resulting mesh with the high-order nodes:

p = mp.plot(V, F, return_plot=True, shading={"wireframe": True})
p.add_points(nodes, shading={"point_size": 10})
p

The previous mesh also outside triangles, to avoid this we enable the option cut_outside

V, F, nodes, F_nodes = wm.triangulate_svg("rocket.svg", cut_outside=True)
1/3 n sub paths: 18
2/3 n sub paths: 5
3/3 n sub paths: 12
p = mp.plot(V, F, return_plot=True, shading={"wireframe": True})
p.add_points(nodes, shading={"point_size": 10})
p

I we want to carve out the window we need to speficy a point inside

V, F, nodes, F_nodes = wm.triangulate_svg("rocket.svg", cut_outside=True, hole_pts=[[255, 165]])
1/3 n sub paths: 18
2/3 n sub paths: 5
3/3 n sub paths: 12
import numpy as np

p = mp.plot(V, F, return_plot=True, shading={"wireframe": True})
p.add_points(nodes, shading={"point_size": 10})
p.add_points(np.array([255, 165]), shading={"point_size": 30, "point_color": "green"})
p

Tetrahedralization (alpha)

The tetrahedralization part is still under developement, for the moment it supports only files as input and output.

wm.tetrahedralize("small.stl", "out.msh")
True