refactor(precision): widen command transform scalars and defaults to f64 (#311)

Completes the f64 migration on the CPU data path: the only f32 left now
is the GPU/render/screen layer, which is architecturally required (wgpu
vertex buffers and iced are f32; f64 vertices would double memory).

- EntityTransform::Rotate.angle_rad and Scale.factor are now f64 (the
  transform was already applied in f64 around the DVec3 center, so this
  only preserves the typed angle/factor). apply_standard_transform and
  apply_standard_scale take f64.
- CmdResult::ExtrudeEntity.height and AlignSelected.{angle_rad,scale}
  are f64; the EXTRUDE height parses as f64.
- defaults.rs (last-used construction values: circle radius/diameter,
  rotate angle, scale factor, offset/fillet/chamfer distance, array
  spacing/counts/angle) moved from Cell<f32> to Cell<f64>. Array counts
  round-trip through u32 (exact below 2^53).
- Consumers in circle/array/fillet/offset/rotate/scale/align/solid3d and
  dimension.rs rotate_point/scale_point follow. `as f32` is kept only
  where a value feeds a WireModel rubber-band/ghost (the preview path is
  screen-space f32).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-12 00:34:38 +03:00
commit 62bd360e46
12 changed files with 100 additions and 102 deletions

View file

@ -8,22 +8,22 @@ fn to_v3(v: DVec3) -> Vector3 {
Vector3::new(v.x, v.y, v.z)
}
pub fn apply_standard_transform<T>(entity: &mut T, center: DVec3, angle_rad: f32)
pub fn apply_standard_transform<T>(entity: &mut T, center: DVec3, angle_rad: f64)
where
T: acadrust::Entity,
{
let z_axis = Vector3::new(0.0, 0.0, 1.0);
let t = Transform::from_translation(to_v3(-center))
.then(&Transform::from_rotation(z_axis, angle_rad as f64))
.then(&Transform::from_rotation(z_axis, angle_rad))
.then(&Transform::from_translation(to_v3(center)));
entity.apply_transform(&t);
}
pub fn apply_standard_scale<T>(entity: &mut T, center: DVec3, factor: f32)
pub fn apply_standard_scale<T>(entity: &mut T, center: DVec3, factor: f64)
where
T: acadrust::Entity,
{
let s = factor as f64;
let s = factor;
let t = Transform::from_scaling_with_origin(Vector3::new(s, s, s), to_v3(center));
entity.apply_transform(&t);
}