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

Extrude bug #974

Closed JeffreyWardman closed 11 months ago

JeffreyWardman commented 11 months ago

Extruding a flat surface directly up causes missing faces with 2023.5.0.

Screenshot 2023-11-16 at 11 57 28 am
marcomusy commented 11 months ago

You should extrude a line not a surface in its own plane as this is not a well defined operation, i guess there's no good way to warn a user against that. Maybe in the doc string of extrude() we can add a caveat.

JeffreyWardman commented 11 months ago

This was working prior to 2023.5.0. I used cut_with_plane on a mesh and then extrude it in the z-axis.

marcomusy commented 11 months ago

I don't understand the image you sent, is the surface along the z-axis?

JeffreyWardman commented 11 months ago

Yes, sorry. It's on an angle from when I was viewing it but it is perfectly parallel to the XY plane.

There's also this example where faces are added. Unfortunately, I can't complete the migration until I/you find what's caused a variation in the extrusion. I'll investigate over the next couple of hours.

Screenshot 2023-11-17 at 8 35 58 am
marcomusy commented 11 months ago

OK. Can you provide a mesh and a script to reproduce the issue?

JeffreyWardman commented 11 months ago

Yep. Give me two hours or so. I'll provide both examples.

JeffreyWardman commented 11 months ago

I've identified the issue. Now that it's not returning a copy of the vertices, if I take a vertex from .vertices and manipulate it, then it will also manipulate the mesh's vertices due to pointing to the same array. I'll have to go through my codebase and update to accommodate for the breaking change. Would be good to add this to the documentation as well as a potential side effect.

Will leave it to you, but happy to close the issue.

# Note: Boundaries generated via mesh.clone().boundaries()
import numpy as np
import vedo

boundaries = vedo.load("boundaries.vtk")

zmin_idx = np.argmax(boundaries.vertices[:, 2])

min_height = 1
lowest_pt = boundaries.vertices[zmin_idx]  # cloning boundaries here resolves the issue

lowest_pt[-1] = lowest_pt[-1] + min_height

plotter = vedo.Plotter(axes=1)
plotter.show(boundaries)

boundaries.zip

marcomusy commented 11 months ago

this is actually not an undesired feature, but i see why it can be confusing..

JeffreyWardman commented 11 months ago

Yeah, I realised. Will close the issue :)