forked from 1b-agent/opencadstudio-upstream
Align arc creation and editing behavior
This commit is contained in:
1 parent
573ed3245e
commit
5f9d8a9e0e
15 files changed
+537
-337
No files matched your search
Vendored
+34
-1
@@ -1227,7 +1227,7 @@ fn translated_prototype_wire(
|
||||
p2[axis] += delta_f32[axis];
|
||||
}
|
||||
}
|
||||
TangentGeom::Circle { center, .. } => {
|
||||
TangentGeom::Circle { center, .. } | TangentGeom::Arc { center, .. } => {
|
||||
for axis in 0..3 {
|
||||
center[axis] += delta_f32[axis];
|
||||
}
|
||||
@@ -2282,6 +2282,39 @@ fn transform_tangent(
|
||||
radius: radius * s,
|
||||
}
|
||||
}
|
||||
TangentGeom::Arc {
|
||||
center,
|
||||
axis_x,
|
||||
axis_y,
|
||||
radius,
|
||||
start_angle,
|
||||
end_angle,
|
||||
} => {
|
||||
let c = t.apply(Vector3::new(center[0] as f64, center[1] as f64, center[2] as f64));
|
||||
let x = t.apply_rotation(Vector3::new(
|
||||
axis_x[0] as f64,
|
||||
axis_x[1] as f64,
|
||||
axis_x[2] as f64,
|
||||
));
|
||||
let y = t.apply_rotation(Vector3::new(
|
||||
axis_y[0] as f64,
|
||||
axis_y[1] as f64,
|
||||
axis_y[2] as f64,
|
||||
));
|
||||
let sx = x.length();
|
||||
let sy = y.length();
|
||||
let scale = (sx + sy) * 0.5;
|
||||
let x = x.normalize();
|
||||
let y = y.normalize();
|
||||
TangentGeom::Arc {
|
||||
center: [c.x as f32, c.y as f32, c.z as f32],
|
||||
axis_x: [x.x as f32, x.y as f32, x.z as f32],
|
||||
axis_y: [y.x as f32, y.y as f32, y.z as f32],
|
||||
radius: radius * scale as f32,
|
||||
start_angle: *start_angle,
|
||||
end_angle: *end_angle,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user