Skip to content

Conversation

@colinthart
Copy link

Added support for generate() to SDF2 based on scikit-image measure.fnd_contours(). Added show() to mesh.py using matplotlib for SDF2 and numpy-stl and vtkplotlib for SDF3. Note: vtkplotlib uses numpy-stl as a dependency.

Comments:
In order for generate and plot to determine the correct behavior, the dimension of sdf needs to be determined. My original approach was to use isinstance(sdf, SDF2) and isinstance(sdf, SDF3) but this created a circular dependency. I added a dimension parameter self.dim to each class that is used for checking.

The stl import in show() is for numpy-stl. I realize this might cause confusion with the existing sdf.stl so I call attention to it here.

I did not implement SDF2 save(). The analogous output to stl might be csv. Pandas may be provide similar flexibility for 2D tabular output files as what can be achieved for 3D meshes with meshio, or meshio may still be the appropriate choice for 2D.

I noticed some strange behavior with the union command. The union() of two SDF2 objects is promoted to SDF3 but the same operation using the overloaded or operator produces an SDF2 object. More testing on SDF2 objects would be useful.

I added three examples demonstrating the new features.

This is my first pull request so I'd be interested to know what your thoughts are. In general this is a great library to work with.
Thanks for sharing!

…nd_contours(). Added show() to mesh.py using matplotlib for SDF2 and numpy-stl and vtkplotlib for SDF3. Note: vtkplotlib uses numpy-stl as a dependency.
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

Successfully merging this pull request may close these issues.

2 participants