forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
427db6cd17
commit
eb0073781f
2 files changed
+11
-11
No files matched your search
@@ -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]];
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in new issue
Block a user