Repository navigation
Pick under the cursor in milliseconds on a city-sized map. - #129
Merged
turbo-devv merged 3 commits intoNov 20, 2026
Merged
Conversation
The pick rebuilt the whole map's row index for every record it looked at, so a map of 485 tiles and 65,000 splines spent about 1.7 s on each move of the view; on NT_merged_v2 that was a visible freeze, eight frames long, every time the mouse moved over the map. The index is now built once per pick and passed down. Records, objects and splines are rejected from their own boxes before a model is read or a curve is built, and only the tiles the ray actually crosses are searched. While the camera is moving the cursor follows the ground and the full pick waits for the view to settle, which it then does once. A pick that still takes over 150 ms says where its time went, so a large map can be measured without the profile.
…k after the view moved takes what is under it - the look past objects the ray cannot reach puts an object at the ground's height plus its own (as it is drawn), not at its own height alone: on ground hundreds of metres up nothing could be picked - the tiles a ray is looked for on reach as far as what stands on them does (a long straight road runs hundreds of metres past its tile), not a fixed 160 m - a spline's bound takes its climb from its gradients and Δh, an arc's too - while the camera eases only the ground was followed: a click (or a right click's menu) in those frames took what was under the cursor before the view moved. It looks again first. 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.
What was wrong
On a large map, moving the mouse over the 3D view froze the view for about two seconds. The profile put it in the
editorsection, and measuring inside the pick showed where:pick_intowalks every[splineAttachement]record near the cursor, and for each one it calledselection::attachment_copies, which builds the whole map'sMapIndex(every spline's length, links and chain offset, over all 485 tiles) — once per record. A tile with a few hundred records therefore rebuilt the index a few hundred times per mouse move.Measured on
NT_merged_v2(485 tiles, 65,727 splines, 45,636 objects):The change
place::row_objects, instead of being rebuilt for every record.selection::attachment_copiesremains for tests, where there is no index to hand.spline_off_ray, a 400 m object sphere). A city has tens of thousands of both.pick_intoandsurface_hitonly look at the tiles the ray crosses (ray_meets_tile, with a margin for a spline that runs past the tile it starts in).OPENMAPPER_PROFILE.The pick result is otherwise unchanged: the same nearest-first stack, the same object-over-spline tie-break.
Tests
cargo test --release --bin openmapper pick— 16 passed.editor::tests::every_copy_of_a_record_on_a_real_map_is_picked_as_that_recordfails both before and after this change on my install: it reads the models of the OMSI content that happens to be installed, and reports 7 copies as the road under them and 1 as nothing onmain(left: (7, 1)) versus 6 and 4 here — it is not a regression, and the run is 40× faster (1,056 s → 27 s), which is the fix itself.