[codex] fix adapter mesh bounds overflow - #126
Merged
Merged
Conversation
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.
Summary
Fixes #125.
The mesh adapter now computes global XYZ bounds in a bounded iterative pass over parsed triangle vertices. It no longer flattens the entire triangle list or passes every mesh reference to
Math.minandMath.max. The parser, fan triangulation, normalization, voxelization, ordering, deduplication, andVoxelPlanbehavior remain unchanged.Cause and fix
The Sydney Opera House input reported by MinePilot #106 contains 82,144 vertices and 129,780 triangles (389,340 triangle-vertex references, about 7.5 MiB). The former global bounds calculation spread all references into
Math.min/Math.max; on Node v22.22.3, argument counts at this scale throwRangeError: Maximum call stack size exceededbefore voxelization.computeMeshBoundsnow updates three minima and maxima while visiting each triangle vertex and avoids the extra flattened array.Regression and acceptance evidence
RangeError.minecraft:quartz_block. It passed bounds and produced a VoxelPlan sized 167×64×113 with 103,811 blocks.Validation
pnpm --filter @i365dev/craftdag-adapter-mesh test— 7 passed.pnpm --filter @i365dev/craftdag-adapter-mesh typecheck— passed.pnpm build— passed.pnpm test— 219 passed.pnpm typecheck— passed.pnpm lint— passed.git diff --check— passed.