Added 2d generate support and mesh.show() previews based on matplotlib and vtkplotlib #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!