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 <noreply@anthropic.com>
This commit is contained in:
parent
427db6cd17
commit
eb0073781f
2 changed files with 11 additions and 11 deletions
|
|
@ -11,13 +11,14 @@ use crate::scene::model::object::{GripApply, GripDef, PropSection};
|
||||||
use crate::scene::model::wire_model::TangentGeom;
|
use crate::scene::model::wire_model::TangentGeom;
|
||||||
|
|
||||||
fn to_truck(line: &Line) -> TruckEntity {
|
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 normal = (line.normal.x, line.normal.y, line.normal.z);
|
||||||
let (sx, sy, sz) = crate::scene::view::transform::ocs_point_to_wcs(
|
let (sx, sy, sz) = (line.start.x, line.start.y, line.start.z);
|
||||||
(line.start.x, line.start.y, line.start.z),
|
let (ex, ey, ez) = (line.end.x, line.end.y, line.end.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 p0 = Point3::new(sx, sy, sz);
|
let p0 = Point3::new(sx, sy, sz);
|
||||||
let p1 = Point3::new(ex, ey, ez);
|
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]];
|
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
|
/// units. Shared by the header-driven path ([`to_truck`]) and the
|
||||||
/// viewport-aware relative path ([`relative_truck`]).
|
/// viewport-aware relative path ([`relative_truck`]).
|
||||||
fn point_truck(pt: &Point, pdmode: i16, s: f64) -> TruckEntity {
|
fn point_truck(pt: &Point, pdmode: i16, s: f64) -> TruckEntity {
|
||||||
let normal = (pt.normal.x, pt.normal.y, pt.normal.z);
|
// POINT location is stored in WCS (the extrusion normal only orients the
|
||||||
let (wx, wy, wz) = crate::scene::view::transform::ocs_point_to_wcs(
|
// glyph/thickness) — remapping it through the arbitrary-axis OCS moved
|
||||||
(pt.location.x, pt.location.y, pt.location.z),
|
// mirrored points (normal 0,0,-1) to the wrong side of the drawing.
|
||||||
normal,
|
let (wx, wy, wz) = (pt.location.x, pt.location.y, pt.location.z);
|
||||||
);
|
|
||||||
let snap = glam::DVec3::new(wx, wy, wz);
|
let snap = glam::DVec3::new(wx, wy, wz);
|
||||||
if pdmode == 0 {
|
if pdmode == 0 {
|
||||||
// Default: a single vertex (driver handles the dot pixel).
|
// Default: a single vertex (driver handles the dot pixel).
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue