fix(hatch): mirrored-block arcs — bump acadrust, document angle convention
Hatches inside mirrored INSERTs (x_scale = -1, e.g. the *U blocks in xref_Plan-Sade) drew some boundary arcs swept the wrong way, covering huge complementary regions — in the pattern clip before EXPLODE, and in both pattern and boundary wires after (the exploded entity bakes the broken angles). Root cause was in acadrust's transform_hatch, not the renderer: DXF stores CW (ccw=false) boundary-arc angles MIRRORED (verified against AutoCAD output by endpoint continuity — mirrored interpretation gives Δ=0.0 against adjacent edges), and the transform stored geometric angles after flipping the direction flag. The legacy (TAU-θ) sampling flip in arc_signed_span is exactly right for file data and stays; its comment now records the verification so the convention isn't "fixed" away again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
25715d1b03
commit
14b5067e25
2 changed files with 10 additions and 1 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -56,7 +56,7 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
|
|||
[[package]]
|
||||
name = "acadrust"
|
||||
version = "0.3.4"
|
||||
source = "git+https://github.com/HakanSeven12/acadrust?branch=main#db110124facbab3fbb4d947871638d73dc8b8a3a"
|
||||
source = "git+https://github.com/HakanSeven12/acadrust?branch=main#ddd6888b261cb104fcf3acd6e62dc197f5d4e769"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
|
|
|
|||
|
|
@ -31,6 +31,15 @@ pub type FallbackGeometry = (
|
|||
/// semantics are preserved on real files. (Wrap-through-2π is a known
|
||||
/// edge case in that convention; do not "fix" it without a wider audit
|
||||
/// of how upstream writers emit CW boundary arcs.)
|
||||
///
|
||||
/// VERIFIED against real AutoCAD output (KSR-039 DWG, CW arc edges with
|
||||
/// line neighbours): the stored angles of a `ccw = false` arc edge are
|
||||
/// MIRRORED — the true point is `center + r·(cos(TAU-θ), sin(TAU-θ))`.
|
||||
/// Sampling the mirrored parameter directly (this function's flip) gives
|
||||
/// exact endpoint continuity with the adjacent edges (Δ = 0.000000),
|
||||
/// while interpreting them as true angles lands tens of units away. Any
|
||||
/// code that *produces* CW boundary arcs (mirror transforms, explode)
|
||||
/// must therefore store mirrored angles, not geometric ones.
|
||||
pub fn arc_signed_span(start: f64, end: f64, ccw: bool) -> (f64, f64) {
|
||||
const TAU: f64 = std::f64::consts::TAU;
|
||||
let (sa, ea) = if ccw { (start, end) } else { (TAU - start, TAU - end) };
|
||||
|
|
|
|||
Loading…
Reference in a new issue