Skip to content

Conversation

@BrianMacIntosh
Copy link

This contains some changes to enable callers to significantly reduce allocations if they are slicing the same mesh multiple times:

  • If the caller constructs a SlicerSourceMesh and passes it to the Slice overload that accepts it, the algorithm can avoid a lot of allocations from fetching mesh data.
  • If the caller passes an existing SlicedHull, the algorithm will re-use the same output meshes.
  • The caller can also opt to not produce either the upper or lower hull if they don't need it, by passing a SlicedHull without them.

With my 60-triangle test mesh, this takes allocations from 80-100 KB to 17-22 KB, and execution time from the high 2 ms to the low-mid 2 ms.

The public API is fully backwards-compatible.

If the caller constructs a SlicerSourceMesh and passes it to the Slice overload that accepts it, the algorithm can avoid a lot of allocations from fetching mesh data.
The caller can also opt to not produce either the upper or lower hull if they don't need it.
With my 60-triangle test mesh, this takes allocations from 80-100 KB to 17-22 KB, and execution time from the high 2 ms to the low-mid 2 ms.
The public API is fully backwards-compatible.
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.

1 participant