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

View File

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