forked from 1b-agent/opencadstudio-upstream
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:
1 parent
553b91015f
commit
62bd360e46
12 files changed
+100
-102
No files matched your search
@@ -4,29 +4,29 @@
|
||||
use std::cell::Cell;
|
||||
|
||||
thread_local! {
|
||||
static CIRCLE_RADIUS: Cell<f32> = Cell::new(1.0);
|
||||
static CIRCLE_DIAM: Cell<f32> = Cell::new(2.0);
|
||||
static ROTATE_ANGLE: Cell<f32> = Cell::new(0.0); // degrees
|
||||
static SCALE_FACTOR: Cell<f32> = Cell::new(1.0);
|
||||
static OFFSET_DIST: Cell<f32> = Cell::new(1.0);
|
||||
static FILLET_RADIUS: Cell<f32> = Cell::new(1.0);
|
||||
static CHAMFER_DIST1: Cell<f32> = Cell::new(10.0);
|
||||
static CHAMFER_DIST2: Cell<f32> = Cell::new(10.0);
|
||||
static ARRAY_ROWS: Cell<f32> = Cell::new(2.0);
|
||||
static ARRAY_COLS: Cell<f32> = Cell::new(2.0);
|
||||
static ARRAY_ROW_SP: Cell<f32> = Cell::new(100.0);
|
||||
static ARRAY_COL_SP: Cell<f32> = Cell::new(100.0);
|
||||
static ARRAY_P_COUNT: Cell<f32> = Cell::new(6.0);
|
||||
static ARRAY_P_ANGLE: Cell<f32> = Cell::new(360.0); // degrees
|
||||
static ARRAY_PATH_COUNT: Cell<f32> = Cell::new(6.0);
|
||||
static CIRCLE_RADIUS: Cell<f64> = Cell::new(1.0);
|
||||
static CIRCLE_DIAM: Cell<f64> = Cell::new(2.0);
|
||||
static ROTATE_ANGLE: Cell<f64> = Cell::new(0.0); // degrees
|
||||
static SCALE_FACTOR: Cell<f64> = Cell::new(1.0);
|
||||
static OFFSET_DIST: Cell<f64> = Cell::new(1.0);
|
||||
static FILLET_RADIUS: Cell<f64> = Cell::new(1.0);
|
||||
static CHAMFER_DIST1: Cell<f64> = Cell::new(10.0);
|
||||
static CHAMFER_DIST2: Cell<f64> = Cell::new(10.0);
|
||||
static ARRAY_ROWS: Cell<f64> = Cell::new(2.0);
|
||||
static ARRAY_COLS: Cell<f64> = Cell::new(2.0);
|
||||
static ARRAY_ROW_SP: Cell<f64> = Cell::new(100.0);
|
||||
static ARRAY_COL_SP: Cell<f64> = Cell::new(100.0);
|
||||
static ARRAY_P_COUNT: Cell<f64> = Cell::new(6.0);
|
||||
static ARRAY_P_ANGLE: Cell<f64> = Cell::new(360.0); // degrees
|
||||
static ARRAY_PATH_COUNT: Cell<f64> = Cell::new(6.0);
|
||||
}
|
||||
|
||||
macro_rules! accessors {
|
||||
($get:ident, $set:ident, $var:ident) => {
|
||||
pub fn $get() -> f32 {
|
||||
pub fn $get() -> f64 {
|
||||
$var.with(|c| c.get())
|
||||
}
|
||||
pub fn $set(v: f32) {
|
||||
pub fn $set(v: f64) {
|
||||
$var.with(|c| c.set(v));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user