cycodebase: reuse AABB / precomputed bases for fast repeated distance queries - #309
Open
alecjacobson wants to merge 1 commit into
Open
cycodebase: reuse AABB / precomputed bases for fast repeated distance queries#309alecjacobson wants to merge 1 commit into
alecjacobson wants to merge 1 commit into
Conversation
…queries point_spline_squared_distance and point_cubic_squared_distance rebuilt their acceleration data on every call. Bind the libigl overloads that accept the precomputed structures so repeated queries against the same spline/curve don't rebuild: - point_spline_squared_distance(Q, P, C, B1, B2, leaf): reuse the Eytzinger AABB from igl.cycodebase.spline_eytzinger_aabb(P, C). - point_cubic_squared_distance(Q, C, D, B): reuse the monomial bases from igl.cubic_monomial_bases(C). Both are added as overloads of the existing names (nanobind dispatches by arity). Tests confirm the accelerated results match the unaccelerated ones and that one prebuilt structure serves multiple query sets. Full suite: 93 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
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.
point_spline_squared_distanceandpoint_cubic_squared_distancerebuilt their acceleration data on every call. This binds the libigl overloads that accept the precomputed structures, so you build once and query many times without rebuilding.New overloads
Reuse the Eytzinger AABB across spline queries:
Reuse the monomial bases across single-cubic queries:
Both are added as overloads of the existing function names (nanobind dispatches by arity), so the original 3-/2-argument calls are unchanged.
Testing
New tests confirm the accelerated results are identical to the unaccelerated overloads and that one prebuilt structure serves multiple query sets. Full suite: 93 passed.
🤖 Generated with Claude Code