Repository navigation
Recompute mesh world bounds and grid intersections after changes - #148
Merged
Merged
Conversation
NwcMesh kept its cached world bounds when Transform was replaced or removed, and NwcGridSystem kept its cached intersections after line endpoints were edited or Lines was changed directly, so bounds, grid intersections and location labels went stale. The Transform setter now clears the cached bounds, and the intersection cache, a small O(n²) pass over the grid lines, is removed. Fixes IOExtend#100 Co-Authored-By: Claude Opus 5.5 <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.
Fixes #100
Following the issue's suggested fix:
NwcMesh.Transformnow has a backing field, and its setter clears_cachedWorldBounds.NwcTransformis init-only, so reassignment is the only way the transform changes.GetWorldBoundingBox()therefore reflects a replaced or removed transform.NwcGridSystemno longer cachesGetIntersections(). The cache went stale afterStart/Endedits or direct changes toLines, and recomputing is a small O(n²) pass over the grid lines.Linesstays aList<NwcGridLine>, so there is no API change.Tests
GridSystemTests:GridSystem_AfterEndpointEdit_UpdatesIntersectionsAndLocation, forStartand forEnd.GridSystem_AfterDirectLineAddition_UpdatesIntersectionsAndLocation.GridSystem_AfterDirectLineRemoval_UpdatesIntersectionsAndLocation.GetIntersections()andFormatLocationafter each change.MeshParserTests:Mesh_GetWorldBoundingBox_AfterTransformAssignment_UsesCurrentTransform.Mesh_GetWorldBoundingBox_AfterTransformRemoval_UsesLocalBounds.All 7 cases fail without the src change.
dotnet build NwcIO.slnxsucceeds, andNwcIO.Testspasses locally: 246 passed, and 2 skipped because they need private Navisworks files (.NET 10.0.400 on Windows, withglobal.jsonpinned down to it temporarily; not committed).The change was drafted with OpenAI Codex, then reviewed and verified with Claude Code.
🤖 Generated with Claude Code