forked from 1b-agent/opencadstudio-upstream
fix(paste): UTM-precise paste/block base via f64 centroid
entities_centroid summed the f32 points (double-single HIGH half) alone, so at UTM scale (~5.7e6) it both quantized each term ~0.5 m and lost low bits across the running total — drifting the paste base and PASTEBLOCK's block base metres off, which placed the wrapped block at the wrong spot/scale. It now reconstructs each vertex's absolute f64 from points + points_low and accumulates in f64. clipboard_centroid is DVec3; the PASTECLIP commit delta is fully f64; define_block_from_owned_entities takes an f64 base so the block-local fold (Translate(-base)) stays precise. The interactive ghost anchors (PasteCommand, InsertBlockCommand) still take the f32 cast — display only; the committed geometry is f64. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe5ff376e5
commit
60d4712179
5 files changed
+31
-21
No files matched your search
+2
-2
@@ -371,7 +371,7 @@ pub(super) struct OpenCADStudio {
|
||||
/// In-memory clipboard: cloned entities waiting to be pasted.
|
||||
clipboard: Vec<acadrust::EntityType>,
|
||||
/// Centroid of the clipboard entities (world XY plane).
|
||||
clipboard_centroid: glam::Vec3,
|
||||
clipboard_centroid: glam::DVec3,
|
||||
/// The source drawing's `world_offset` at copy time. The centroid above is
|
||||
/// measured in that drawing's offset-relative frame; pasting into a drawing
|
||||
/// with a different offset (e.g. a large-coordinate file → a fresh one)
|
||||
@@ -1808,7 +1808,7 @@ impl OpenCADStudio {
|
||||
update_notice_version: None,
|
||||
update_notice_body: None,
|
||||
clipboard: Vec::new(),
|
||||
clipboard_centroid: glam::Vec3::ZERO,
|
||||
clipboard_centroid: glam::DVec3::ZERO,
|
||||
clipboard_world_offset: [0.0; 3],
|
||||
clipboard_deps: ClipboardDeps::default(),
|
||||
shift_down: false,
|
||||
|
||||
Reference in new issue
Block a user