Repository navigation
XLINE/RAY: a vertex every decade so the line survives zooming in - #3613
Merged
Merged
Conversation
Far from the base point the on-screen part of a construction line was one segment whose ends sit far outside the view; zoomed in, its sub-pixel width offset rounded away in f32 and the line vanished. Render Ray/XLine as a run with a vertex every decade (1 .. 1e6) from the base point, so the segment under the view ends close to it. 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.
Problem
An XLINE or RAY is rendered as one segment from its base point to a point very far away. Zoomed in on a part of the
line far from the base point (a view tens of metres wide, a few hundred metres out), thin construction lines vanish:
the sub-pixel width offset added in clip space is smaller than an f32 step at the segment's far-off clip coordinates
and rounds away, leaving a zero-width quad. Lines with a lineweight of about a pixel or more survive; horizontal and
vertical lines are mostly unaffected.
Fix
src/entities/ray.rsrenders Ray/XLine as a run with a vertex every decade from the base point (1, 10, ... 1e6), sothe segment under the view ends within about ten times the view's distance from the base point and keeps its
width.
Tests
display_run_tests::xline_renders_a_vertex_every_decade_both_waysandray_renders_from_its_base_with_decade_vertices.cargo test --lib: 7104 passed, 0 failed (46 ignored)Manual check
Synthetic DXF with XLINEs at several angles and distances plus a LINE for reference: zoomed to a 60-unit view about
700 units from the origin, the lines stay visible with the default lineweight (before: they disappeared).