jimy-byerley/pymadcad

show([mesh]) mutates mesh

GlennWSo opened this issue · 2 comments

hi

i expected that show([mesh]) should not mutate mesh.

This causes problems when debugging, I cant inspect visually without mutating my objects.

simple snippet:

from madcad import icosahedron, show, vec3

ico = icosahedron(vec3(0), 1)
print(ico)
# > Mesh with 12 points, 20 faces
show([ico])
print(ico)
# > Mesh with 62 points, 20 faces

Hi !
That's ... odd indeed. I suspect this is because of some extraction methods of the mesh being called in Mesh.display() for getting the group edges, wireframe, etc

I got it: Mesh.display() is duplicating some points to have separate vertices in the openGL buffer. Those duplication could happen on a copy of the original buffer instead.
It is much better to fix that because a display is like a measurement: it shall not affect what we measure.