forked from 1b-agent/opencadstudio-upstream
fix(linetype): keep complex linetypes precise at large coordinates
A circle with a complex linetype (embedded shapes/text, e.g. IZOLACE) drew its dashes and symbols scattered far off the entity at UTM-scale coordinates. Two defects compounded, both catastrophic-cancellation at a ~1.2M-unit origin: - The single-entity complex-linetype path fed apply_along the wire's HIGH double-single half only (`base.points`), an absolute f32 quantised to ~0.1 at 1.2M. Walking the pattern along those points blew the shape / dash positions up to ~1e308. Reconstruct the absolute f64 path from high+low, re-origin it at the first vertex, walk apply_along in that local frame, then lift each result wire back to world with shift_wire_to_world (now pub(crate)) — the same local-frame trick the MLINE complex-linetype path already uses. Fixes every entity, not just circles. - The circle was tessellated with truck's circle_arc (arc-through-three- points), whose fit cancels catastrophically at 1.2M and returned a ~3% radius wobble with uneven segments. Tessellate directly as a cos/sin polyline (adaptive segment count from the curve tolerance); adding a small ±r term to the centre stays precise, and the Lines path RTE-splits it. Arc and polyline bulges share the circle_arc root and remain to fix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d3f33de10
commit
5e2b67c642
3 files changed
+70
-23
No files matched your search
@@ -74,7 +74,7 @@ pub(crate) fn points_to_ds(
|
||||
/// The MLINE complex-linetype path uses this because `apply_along` lays out its
|
||||
/// dashes and glyphs in f32, which would otherwise quantise fine spacing far
|
||||
/// from the origin.
|
||||
fn shift_wire_to_world(w: &mut WireModel, origin: [f64; 3]) {
|
||||
pub(crate) fn shift_wire_to_world(w: &mut WireModel, origin: [f64; 3]) {
|
||||
if !w.points.is_empty() {
|
||||
let mut hi = Vec::with_capacity(w.points.len());
|
||||
let mut lo = Vec::with_capacity(w.points.len());
|
||||
|
||||
Reference in new issue
Block a user