forked from 1b-agent/opencadstudio-upstream
fix(3d): revolve axis and OBJ import use the Z-up world, not stale Y-up
The truck B-rep pipeline is Z-up (solids extrude/raise along Z, profile wires convert pass-through), but two spots still assumed a Y-up world: - REVOLVE swapped the axis/origin to (x, z, y), so the revolve axis sat in the XZ plane while the profile sat in XY → wrong solid. Use the axis/origin straight through. - OBJ import kept Y-up coordinates as-is on the (now Z-up) viewport, so imported meshes lay on their side. Rotate +90° about X on import (positions + normals): (x, y, z) → (x, -z, y). EXTRUDE (sweep along +Z) and the box/cylinder primitives were already Z-up and unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
d7135761c9
commit
d8c60c32d4
2 files changed
+6
-5
No files matched your search
@@ -1230,11 +1230,11 @@ impl OpenCADStudio {
|
|||||||
let wire = wire?;
|
let wire = wire?;
|
||||||
let origin = Point3::new(
|
let origin = Point3::new(
|
||||||
axis_start.x as f64,
|
axis_start.x as f64,
|
||||||
axis_start.z as f64,
|
|
||||||
axis_start.y as f64,
|
axis_start.y as f64,
|
||||||
|
axis_start.z as f64,
|
||||||
);
|
);
|
||||||
let dir = (axis_end - axis_start).normalize();
|
let dir = (axis_end - axis_start).normalize();
|
||||||
let axis = TruckVec3::new(dir.x as f64, dir.z as f64, dir.y as f64);
|
let axis = TruckVec3::new(dir.x as f64, dir.y as f64, dir.z as f64);
|
||||||
let shell = builder::rsweep(
|
let shell = builder::rsweep(
|
||||||
&wire,
|
&wire,
|
||||||
origin,
|
origin,
|
||||||
|
|||||||
+4
-3
@@ -27,14 +27,15 @@ pub fn parse_obj(src: &str, color: [f32; 4]) -> Option<MeshModel> {
|
|||||||
"v" => {
|
"v" => {
|
||||||
let vals: Vec<f32> = parts.filter_map(|s| s.parse().ok()).collect();
|
let vals: Vec<f32> = parts.filter_map(|s| s.parse().ok()).collect();
|
||||||
if vals.len() >= 3 {
|
if vals.len() >= 3 {
|
||||||
// OBJ: Y-up right-handed. OpenCADStudio viewport is also Y-up → keep as-is.
|
// OBJ is Y-up right-handed; OpenCADStudio's world is Z-up.
|
||||||
positions.push([vals[0], vals[1], vals[2]]);
|
// Rotate +90° about X so OBJ Y→world Z (up): (x, y, z) → (x, -z, y).
|
||||||
|
positions.push([vals[0], -vals[2], vals[1]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"vn" => {
|
"vn" => {
|
||||||
let vals: Vec<f32> = parts.filter_map(|s| s.parse().ok()).collect();
|
let vals: Vec<f32> = parts.filter_map(|s| s.parse().ok()).collect();
|
||||||
if vals.len() >= 3 {
|
if vals.len() >= 3 {
|
||||||
normals_raw.push([vals[0], vals[1], vals[2]]);
|
normals_raw.push([vals[0], -vals[2], vals[1]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"f" => {
|
"f" => {
|
||||||
|
|||||||
Reference in new issue
Block a user