Skip to content

XLINE/RAY: a vertex every decade so the line survives zooming in - #3613

Merged
HakanSeven12 merged 1 commit into
HakanSeven12:mainfrom
insanedps:pr/xline-zoom
Nov 24, 2026
Merged

HakanSeven12 merged 1 commit into
HakanSeven12:mainfrom
insanedps:pr/xline-zoom

Conversation

@insanedps

Copy link
Copy Markdown
Contributor

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.rs renders Ray/XLine as a run with a vertex every decade from the base point (1, 10, ... 1e6), so
the segment under the view ends within about ten times the view's distance from the base point and keeps its
width.

Tests

  • New display_run_tests::xline_renders_a_vertex_every_decade_both_ways and
    ray_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).

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>
@HakanSeven12
HakanSeven12 merged commit 1156319 into HakanSeven12:main Nov 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants