From eb0073781f5d938536e08900b0247c2b9b796f13 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 21 Jul 2026 17:27:51 +0300 Subject: [PATCH] fix(render): LINE/POINT endpoints are WCS, not OCS DXF/DWG store LINE endpoints and POINT locations in world coordinates - the extrusion normal only orients the thickness sweep / glyph. Running them through the arbitrary-axis OCS mirrored every line and point carried over from a MIRROR (normal 0,0,-1) onto the wrong side of the drawing: bolt shafts of a mirrored detail block landed in the adjacent panel while its nut arcs (correctly OCS-mapped) stayed put. Co-Authored-By: Claude Fable 5 --- src/entities/line.rs | 13 +++++++------ src/entities/point.rs | 9 ++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/entities/line.rs b/src/entities/line.rs index 015be6faf..f2d7ba866 100644 --- a/src/entities/line.rs +++ b/src/entities/line.rs @@ -11,13 +11,14 @@ use crate::scene::model::object::{GripApply, GripDef, PropSection}; use crate::scene::model::wire_model::TangentGeom; fn to_truck(line: &Line) -> TruckEntity { + // LINE endpoints are stored in WCS — unlike the planar OCS entities + // (ARC/CIRCLE/LWPOLYLINE/TEXT), the extrusion normal on a LINE only + // orients its thickness sweep. Remapping the endpoints through the + // arbitrary-axis OCS mirrored every line carried over from a MIRROR + // (normal 0,0,-1) to the wrong side of the drawing. let normal = (line.normal.x, line.normal.y, line.normal.z); - let (sx, sy, sz) = crate::scene::view::transform::ocs_point_to_wcs( - (line.start.x, line.start.y, line.start.z), - normal, - ); - let (ex, ey, ez) = - crate::scene::view::transform::ocs_point_to_wcs((line.end.x, line.end.y, line.end.z), normal); + let (sx, sy, sz) = (line.start.x, line.start.y, line.start.z); + let (ex, ey, ez) = (line.end.x, line.end.y, line.end.z); let p0 = Point3::new(sx, sy, sz); let p1 = Point3::new(ex, ey, ez); let kv: Vec<[f64; 3]> = vec![[p0.x, p0.y, p0.z], [p1.x, p1.y, p1.z]]; diff --git a/src/entities/point.rs b/src/entities/point.rs index 8e9e74648..d37b39632 100644 --- a/src/entities/point.rs +++ b/src/entities/point.rs @@ -30,11 +30,10 @@ fn pdsize_world(pdsize: f64) -> f64 { /// units. Shared by the header-driven path ([`to_truck`]) and the /// viewport-aware relative path ([`relative_truck`]). fn point_truck(pt: &Point, pdmode: i16, s: f64) -> TruckEntity { - let normal = (pt.normal.x, pt.normal.y, pt.normal.z); - let (wx, wy, wz) = crate::scene::view::transform::ocs_point_to_wcs( - (pt.location.x, pt.location.y, pt.location.z), - normal, - ); + // POINT location is stored in WCS (the extrusion normal only orients the + // glyph/thickness) — remapping it through the arbitrary-axis OCS moved + // mirrored points (normal 0,0,-1) to the wrong side of the drawing. + let (wx, wy, wz) = (pt.location.x, pt.location.y, pt.location.z); let snap = glam::DVec3::new(wx, wy, wz); if pdmode == 0 { // Default: a single vertex (driver handles the dot pixel).