mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-06 10:58:28 +00:00
Add AnchoredCurve::from_origin_and_curve
This commit is contained in:
parent
cc183bc469
commit
38d62383af
@ -23,16 +23,23 @@ pub struct AnchoredCurve {
|
||||
}
|
||||
|
||||
impl AnchoredCurve {
|
||||
pub fn from_origin_and_curve(
|
||||
origin: Point<3>,
|
||||
curve: impl CurveGeometry + 'static,
|
||||
) -> Self {
|
||||
Self {
|
||||
origin,
|
||||
floating: Box::new(curve),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn line_from_origin_and_direction(
|
||||
origin: Point<3>,
|
||||
direction: Vector<3>,
|
||||
) -> Self {
|
||||
let line = Line { direction };
|
||||
|
||||
Self {
|
||||
origin,
|
||||
floating: Box::new(line),
|
||||
}
|
||||
Self::from_origin_and_curve(origin, line)
|
||||
}
|
||||
|
||||
pub fn line_from_points([a, b]: [Point<3>; 2]) -> Self {
|
||||
|
@ -110,10 +110,9 @@ impl Sketch {
|
||||
};
|
||||
|
||||
Handle::new(Curve {
|
||||
geometry: AnchoredCurve {
|
||||
origin,
|
||||
floating: Box::new(circle),
|
||||
},
|
||||
geometry: AnchoredCurve::from_origin_and_curve(
|
||||
origin, circle,
|
||||
),
|
||||
})
|
||||
}
|
||||
SketchSegment::Line { .. } => {
|
||||
|
@ -16,10 +16,7 @@ impl SweptCurve {
|
||||
let [u, v] = axes.map(Into::into).map(|direction| Line { direction });
|
||||
|
||||
Self {
|
||||
u: AnchoredCurve {
|
||||
origin,
|
||||
floating: Box::new(u),
|
||||
},
|
||||
u: AnchoredCurve::from_origin_and_curve(origin, u),
|
||||
v: Box::new(v),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user