mirror of https://github.com/hannobraun/Fornjot
Make method more convenient to call
This commit is contained in:
parent
f4bf0aa8cf
commit
32903edf30
|
@ -12,7 +12,7 @@ pub trait CycleBuilder {
|
||||||
/// Update the partial cycle with a polygonal chain from the provided points
|
/// Update the partial cycle with a polygonal chain from the provided points
|
||||||
fn with_poly_chain(
|
fn with_poly_chain(
|
||||||
self,
|
self,
|
||||||
vertices: impl IntoIterator<Item = MaybePartial<SurfaceVertex>>,
|
vertices: impl IntoIterator<Item = impl Into<MaybePartial<SurfaceVertex>>>,
|
||||||
) -> Self;
|
) -> Self;
|
||||||
|
|
||||||
/// Update the partial cycle with a polygonal chain from the provided points
|
/// Update the partial cycle with a polygonal chain from the provided points
|
||||||
|
@ -30,8 +30,10 @@ pub trait CycleBuilder {
|
||||||
impl CycleBuilder for PartialCycle {
|
impl CycleBuilder for PartialCycle {
|
||||||
fn with_poly_chain(
|
fn with_poly_chain(
|
||||||
self,
|
self,
|
||||||
vertices: impl IntoIterator<Item = MaybePartial<SurfaceVertex>>,
|
vertices: impl IntoIterator<Item = impl Into<MaybePartial<SurfaceVertex>>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let vertices = vertices.into_iter().map(Into::into);
|
||||||
|
|
||||||
let iter = self
|
let iter = self
|
||||||
.half_edges()
|
.half_edges()
|
||||||
.last()
|
.last()
|
||||||
|
@ -100,9 +102,7 @@ impl CycleBuilder for PartialCycle {
|
||||||
points: impl IntoIterator<Item = impl Into<Point<2>>>,
|
points: impl IntoIterator<Item = impl Into<Point<2>>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.with_poly_chain(points.into_iter().map(|position| {
|
self.with_poly_chain(points.into_iter().map(|position| {
|
||||||
SurfaceVertex::partial()
|
SurfaceVertex::partial().with_position(Some(position))
|
||||||
.with_position(Some(position))
|
|
||||||
.into()
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue