fix(wipeout): use real clip vertices, correct image-pixel→WCS mapping

acadrust's DWG reader read the wipeout/raster-image clip boundary
points only to advance the bit cursor and then discarded them, so every
wipeout fell back to `Wipeout::new()`'s default placeholder rectangle
(`-0.5..0.5`). For files that store the real polygon mask in clip
vertices (anteen.dwg's `DIMBLOCK` style: u_vector ≈ 643k, size = (1, 1),
clip polygon ~0.0016×0.0033 in pixel space), the wipeout rendered at the
full image bbox — hundreds of thousands of units wide — instead of the
intended ~1000×2000 mask.

Pinned to the new `fix/wipeout-clip-vertices` acadrust branch (carries
the upstream parser fix). On the H7CAD side, the polygon mapping now
follows the DXF convention:

  x_off = (clip.x + size.x/2) × u_vec
  y_off = (size.y/2 − clip.y) × v_vec      (image-Y points down)

…in `wipeout_boundary_2d` (fill), `Wipeout::to_truck` (border line),
and `Wipeout::grips` (vertex handles) so all three stay in sync. The
fill path also explicitly closes the polygon loop — without it the GPU
`in_polygon` ray-cast skipped the v(n-1)→v(0) edge and the solid mask
bled far past the boundary.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hakan 2026-05-22 14:14:22 +03:00
commit 8e6491d4a8
4 changed files with 49 additions and 25 deletions

View file

@ -24,7 +24,8 @@ ureq = { version = "2", default-features = false, features = ["tls"] }
windows-sys = { version = "0.59", features = ["Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] }
[patch.crates-io]
# TEMP: tracks https://github.com/hakanaktt/acadrust/pull/27 (hatch
# boundary-handle cap). When that PR lands on hakanaktt/main, revert to
# `git = "https://github.com/hakanaktt/acadrust", branch = "main"`.
acadrust = { git = "https://github.com/HakanSeven12/acadrust", branch = "fix/hatch-boundary-handle-cap" }
# TEMP: tracks fix/wipeout-clip-vertices on HakanSeven12/acadrust, which
# stacks the wipeout/raster-image clip-vertex fix on top of the earlier
# hatch boundary-handle cap. Revert to `branch = "main"` once both
# upstream PRs land.
acadrust = { git = "https://github.com/HakanSeven12/acadrust", branch = "fix/wipeout-clip-vertices" }