mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-08 20:08:30 +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 {
|
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(
|
pub fn line_from_origin_and_direction(
|
||||||
origin: Point<3>,
|
origin: Point<3>,
|
||||||
direction: Vector<3>,
|
direction: Vector<3>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let line = Line { direction };
|
let line = Line { direction };
|
||||||
|
|
||||||
Self {
|
Self::from_origin_and_curve(origin, line)
|
||||||
origin,
|
|
||||||
floating: Box::new(line),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn line_from_points([a, b]: [Point<3>; 2]) -> Self {
|
pub fn line_from_points([a, b]: [Point<3>; 2]) -> Self {
|
||||||
|
@ -110,10 +110,9 @@ impl Sketch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Handle::new(Curve {
|
Handle::new(Curve {
|
||||||
geometry: AnchoredCurve {
|
geometry: AnchoredCurve::from_origin_and_curve(
|
||||||
origin,
|
origin, circle,
|
||||||
floating: Box::new(circle),
|
),
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
SketchSegment::Line { .. } => {
|
SketchSegment::Line { .. } => {
|
||||||
|
@ -16,10 +16,7 @@ impl SweptCurve {
|
|||||||
let [u, v] = axes.map(Into::into).map(|direction| Line { direction });
|
let [u, v] = axes.map(Into::into).map(|direction| Line { direction });
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
u: AnchoredCurve {
|
u: AnchoredCurve::from_origin_and_curve(origin, u),
|
||||||
origin,
|
|
||||||
floating: Box::new(u),
|
|
||||||
},
|
|
||||||
v: Box::new(v),
|
v: Box::new(v),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user