-
Notifications
You must be signed in to change notification settings - Fork 597
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
Release: SVG Shapes #2363
Merged
Merged
Release: SVG Shapes #2363
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Owner
mikedh
commented
Feb 26, 2025
•
edited
Loading
edited
- support most of the basic shapes in SVG imports rather than just path strings. Unsupported are ellipses and rounded rectangles. Fixes Loading shapes of svg not defined as <path d=" #2361
- release Efficient Laplacian calculations #2362
The current implementation of `trimesh.smoothing.laplacian_calculation` relies on list comprehensions. The case of `equal_weight=True`, at least, can be computed directly using sparse matrix operations. This PR does that, which turns out to be nearly 20 times faster. I have been unable to figure out a way of computing the `equal_weight=False` case using sparse matrix operations, so I have let the current implementation of that be. This implies quite a performance difference between the two flag values. This is noted in the docstring, which is now also more descriptive. Correctness tests are added, which include a verbatim copy of the original implementation to test against. Performance characteristics: ```python In [1]: import trimesh In [2]: from tests import test_smoothing In [3]: m = trimesh.creation.icosphere(8, 10) In [4]: m.vertices.shape, m.faces.shape Out[4]: ((655362, 3), (1310720, 3)) In [5]: %timeit trimesh.smoothing.laplacian_calculation(m, equal_weight=True) 44.4 ms ± 783 μs per loop (mean ± std. dev. of 7 runs, 1 loop each) In [6]: %timeit test_smoothing.explicit_laplacian_calculation(m, equal_weight=True) 790 ms ± 9.89 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) In [7]: %timeit trimesh.smoothing.laplacian_calculation(m, equal_weight=False) 2.87 s ± 31.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) In [8]: %timeit test_smoothing.explicit_laplacian_calculation(m, equal_weight=False) 2.91 s ± 34.8 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) ``` where `test_smoothing.explicit_laplacian_calculation` is the original implementation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.