add needed tangential arc params to the serializable path

This commit is contained in:
Mike Farrell
2024-10-11 11:11:27 -07:00
parent 0a1201e680
commit e65358f635
2 changed files with 10 additions and 2 deletions

View File

@ -1459,8 +1459,10 @@ pub enum Path {
#[serde(flatten)]
base: BasePath,
/// angle range
#[ts(type = "[number, number]")]
angle_range: [f64; 2],
/// center
#[ts(type = "[number, number]")]
center: [f64; 2],
/// the arc's radius
radius: f64,
@ -1484,6 +1486,10 @@ pub enum Path {
center: [f64; 2],
/// arc's direction
ccw: bool,
/// the arc's radius
radius: f64,
/// the arc's angle offset
offset: f64,
},
// TODO: consolidate segment enums, remove Circle. https://github.com/KittyCAD/modeling-app/issues/3940
/// a complete arc

View File

@ -1693,7 +1693,7 @@ async fn inner_tangential_arc(
let id = uuid::Uuid::new_v4();
let (center, to, ccw) = match data {
let (center, to, ccw, radius, offset) = match data {
TangentialArcData::RadiusAndOffset { radius, offset } => {
// KCL stdlib types use degrees.
let offset = Angle::from_degrees(offset);
@ -1731,13 +1731,15 @@ async fn inner_tangential_arc(
}),
)
.await?;
(center, to.into(), ccw)
(center, to.into(), ccw, radius, offset)
}
};
let current_path = Path::TangentialArc {
ccw,
center: center.into(),
radius,
offset: offset.to_degrees(),
base: BasePath {
from: from.into(),
to,