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
@@ -4204,7 +4204,7 @@ impl Scene {
|
||||
&mut self,
|
||||
entities: Vec<EntityType>,
|
||||
name: &str,
|
||||
base: glam::Vec3,
|
||||
base: glam::DVec3,
|
||||
) -> Result<(), String> {
|
||||
let name = name.trim();
|
||||
if name.is_empty() {
|
||||
@@ -4248,7 +4248,7 @@ impl Scene {
|
||||
.add_entity(EntityType::BlockEnd(block_end))
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let local = EntityTransform::Translate((-base).as_dvec3());
|
||||
let local = EntityTransform::Translate(-base);
|
||||
for mut entity in entities {
|
||||
view::dispatch::apply_transform(&mut entity, &local);
|
||||
entity = crate::modules::draw::modify::explode::normalize_entity_for_block(entity);
|
||||
|
||||
Reference in new issue
Block a user