fix(point): match AutoCAD PDMODE glyph geometry

The mode-4 tick was drawn as a full vertical line centred on the point;
AutoCAD draws it rising from the point upward by PDSIZE/2. The '+' and
'×' arms were half size — AutoCAD extends them to the full PDSIZE so the
cross pokes out past an enclosing circle/square (which sit at PDSIZE/2).
Ground-truthed every PDMODE combination against ezdxf's point renderer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-18 17:07:27 +03:00
1 parent f2adfad2b3
commit 3be9d8925e
1 file changed
+10 -5
+10 -5
View File
@@ -111,6 +111,9 @@ fn point_glyph(cx: f64, cy: f64, z: f64, pdmode: i16, s_half: f64) -> Vec<[f64;
let circle = (pdmode & 32) != 0; let circle = (pdmode & 32) != 0;
let square = (pdmode & 64) != 0; let square = (pdmode & 64) != 0;
let s = s_half; let s = s_half;
// The '+' and '×' arms reach the full PDSIZE (twice the radius), so the
// cross pokes out past any enclosing circle/square, which sit at the radius.
let arm = 2.0 * s_half;
let nan = [f64::NAN, f64::NAN, f64::NAN]; let nan = [f64::NAN, f64::NAN, f64::NAN];
let mut pts: Vec<[f64; 3]> = Vec::new(); let mut pts: Vec<[f64; 3]> = Vec::new();
let mut push_seg = |a: [f64; 3], b: [f64; 3]| { let mut push_seg = |a: [f64; 3], b: [f64; 3]| {
@@ -129,15 +132,17 @@ fn point_glyph(cx: f64, cy: f64, z: f64, pdmode: i16, s_half: f64) -> Vec<[f64;
} }
1 => {} // explicit nothing 1 => {} // explicit nothing
2 => { 2 => {
push_seg([cx - s, cy, z], [cx + s, cy, z]); push_seg([cx - arm, cy, z], [cx + arm, cy, z]);
push_seg([cx, cy - s, z], [cx, cy + s, z]); push_seg([cx, cy - arm, z], [cx, cy + arm, z]);
} }
3 => { 3 => {
push_seg([cx - s, cy - s, z], [cx + s, cy + s, z]); push_seg([cx - arm, cy - arm, z], [cx + arm, cy + arm, z]);
push_seg([cx - s, cy + s, z], [cx + s, cy - s, z]); push_seg([cx - arm, cy + arm, z], [cx + arm, cy - arm, z]);
} }
4 => { 4 => {
push_seg([cx, cy - s, z], [cx, cy + s, z]); // Upward tick rising from the point (length = PDSIZE/2), not a
// vertical line centred on it.
push_seg([cx, cy, z], [cx, cy + s, z]);
} }
_ => { _ => {
push_seg([cx - s, cy, z], [cx + s, cy, z]); push_seg([cx - s, cy, z], [cx + s, cy, z]);