Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting vertex #6

Closed
ty-dev opened this issue Feb 19, 2016 · 1 comment
Closed

Deleting vertex #6

ty-dev opened this issue Feb 19, 2016 · 1 comment

Comments

@ty-dev
Copy link

ty-dev commented Feb 19, 2016

Is it possible to delete a vertex?

@dranjan
Copy link
Owner

dranjan commented Feb 20, 2016

Not literally, but you can create a new NumPy array and reassign the data member of the PlyElement instance. numpy.delete may help here.

>>> vertex = numpy.array([(0, 0, 0),
...                       (0, 1, 1),
...                       (1, 0, 1),
...                       (1, 1, 0)],
...                      dtype=[('x', 'f4'), ('y', 'f4'),
...                             ('z', 'f4')])
>>> el = PlyElement.describe(vertex, 'vertex')
>>> el.count
4
>>> el.data = numpy.delete(el.data, 2, axis=0)
>>> el.count
3
>>> el.data
array([(0.0, 0.0, 0.0), (0.0, 1.0, 1.0), (1.0, 1.0, 0.0)], 
      dtype=[('x', '<f4'), ('y', '<f4'), ('z', '<f4')])

@dranjan dranjan closed this as completed Feb 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants