forked from 1b-agent/opencadstudio-upstream
fix(commands): finish the world-XY coordinate migration (#54)
The drawing plane is world XY, but break, join, rectangular array, the stretch/window move, the spline preview wire and several doc comments still used the stale "Y-up XZ" mapping (world Z = DXF Y). That made those commands operate against a constant-elevation axis: arc/circle/ line/spline break and join picked the wrong points, rectangular array stepped rows along the Z (elevation) axis, window-stretch tested the wrong window bound, and the spline wire drew in the wrong plane. Map every drawing-plane coordinate through .y (elevation on .z), matching the entity builders, the inquiry commands and the central transform. Stale Y-up comments updated to avoid future confusion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c04bdcf846
commit
c7a7f2f742
9 files changed
+35
-34
No files matched your search
@@ -723,7 +723,7 @@ impl OpenCADStudio {
|
||||
},
|
||||
);
|
||||
}
|
||||
// Step 3: rotate in XZ plane by angle_rad
|
||||
// Step 3: rotate in the XY plane by angle_rad
|
||||
if angle_rad.abs() > 1e-4 {
|
||||
self.tabs[i].scene.transform_entities(
|
||||
&handles,
|
||||
@@ -989,16 +989,16 @@ impl OpenCADStudio {
|
||||
let mut count = 0usize;
|
||||
|
||||
// Helper: is DXF point (x, y) inside the world-space window?
|
||||
// World XZ = DXF XY.
|
||||
// Drawing plane is world XY (= DXF XY).
|
||||
let in_win = |x: f64, y: f64| -> bool {
|
||||
let wx = x as f32;
|
||||
let wy = y as f32;
|
||||
wx >= win_min.x && wx <= win_max.x && wy >= win_min.z && wy <= win_max.z
|
||||
wx >= win_min.x && wx <= win_max.x && wy >= win_min.y && wy <= win_max.y
|
||||
};
|
||||
|
||||
let dx = delta.x as f64;
|
||||
let dy = delta.z as f64; // world Z = DXF Y
|
||||
let dz = delta.y as f64;
|
||||
let dy = delta.y as f64; // drawing plane is world XY
|
||||
let dz = delta.z as f64;
|
||||
|
||||
for handle in &handles {
|
||||
let Some(entity) = self.tabs[i].scene.document.get_entity_mut(*handle) else {
|
||||
|
||||
+1
-1
@@ -252,7 +252,7 @@ pub(super) struct OpenCADStudio {
|
||||
update_notice_body: Option<String>,
|
||||
/// In-memory clipboard: cloned entities waiting to be pasted.
|
||||
clipboard: Vec<acadrust::EntityType>,
|
||||
/// Centroid of the clipboard entities (XZ plane, Y-up).
|
||||
/// Centroid of the clipboard entities (world XY plane).
|
||||
clipboard_centroid: glam::Vec3,
|
||||
/// True while the Shift key is held — drives subtractive pick (Shift+click
|
||||
/// removes the picked entity from the selection). Tracked from keyboard
|
||||
|
||||
Reference in new issue
Block a user