marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
2.04k stars 265 forks source link

Custom Mesh #219

Closed adrian-reiban closed 4 years ago

adrian-reiban commented 4 years ago

Hello, I have a problem to create a custom Mesh similar to image Figure_1

When using the Mesh ([verts, faces]) function, it causes problems when filling the region delimited by the vertices of the mesh; What would be the proper function for such a purpose?

This is the vertices list vertices1 = [(10, 10, 10), (30, 30, 10), (20, 50, 10), (40, 40, 10), (60, 50, 10), (50, 30, 10), (70, 10, 10), (45, 0, 10)] vertices2 = [(10, 10, 20), (30, 30, 20), (20, 50, 20), (40, 40, 20), (60, 50, 20), (50, 30, 20), (70, 10, 20), (45, 0, 20)]

Basically I want to build an irregular polygon and then join the top and bottom faces to form a solid

Thanks

marcomusy commented 4 years ago

Hi Adrian, try:


from vedo import *
verts = [(10, 10, 10), (30, 30, 10), (20, 50, 10), (40, 40, 10), (60, 50, 10), (50, 30, 10), (70, 10, 10), (45, 0, 10)]
ln = Line(verts, closed=True)
polyg = ln.clone().triangulate() # clone just makes a copy of ln
extruded = polyg.extrude(10)
show(ln, polyg, extruded, N=3, axes=1)

image

adrian-reiban commented 4 years ago

Thank you very much for the help =)