mirror of https://github.com/hannobraun/Fornjot
Simplify `PartialHalfEdge::with_vertices`
This commit is contained in:
parent
421e03efda
commit
5ccea9e80e
|
@ -37,7 +37,7 @@ impl TransformObject for PartialHalfEdge {
|
||||||
|
|
||||||
Ok(Self::default()
|
Ok(Self::default()
|
||||||
.with_curve(curve)
|
.with_curve(curve)
|
||||||
.with_vertices(Some(vertices))
|
.with_vertices(vertices)
|
||||||
.with_global_form(global_form))
|
.with_global_form(global_form))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl CycleBuilder for PartialCycle {
|
||||||
half_edges.push(
|
half_edges.push(
|
||||||
HalfEdge::partial()
|
HalfEdge::partial()
|
||||||
.with_curve(curve)
|
.with_curve(curve)
|
||||||
.with_vertices(Some([from, to])),
|
.with_vertices([from, to]),
|
||||||
);
|
);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -79,7 +79,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
||||||
.with_surface_form(surface_vertex.clone())
|
.with_surface_form(surface_vertex.clone())
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(self.with_curve(curve).with_vertices(Some([back, front])))
|
Ok(self.with_curve(curve).with_vertices([back, front]))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_as_line_segment_from_points(
|
fn update_as_line_segment_from_points(
|
||||||
|
@ -96,7 +96,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
||||||
});
|
});
|
||||||
|
|
||||||
self.with_surface(surface)
|
self.with_surface(surface)
|
||||||
.with_vertices(Some(vertices))
|
.with_vertices(vertices)
|
||||||
.update_as_line_segment()
|
.update_as_line_segment()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
self.with_curve(curve).with_vertices(Some([back, front]))
|
self.with_curve(curve).with_vertices([back, front])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,10 @@ impl<'a> ShellBuilder<'a> {
|
||||||
.with_surface(Some(surface.clone()));
|
.with_surface(Some(surface.clone()));
|
||||||
|
|
||||||
HalfEdge::partial()
|
HalfEdge::partial()
|
||||||
.with_vertices(Some([
|
.with_vertices([
|
||||||
Vertex::partial().with_surface_form(from),
|
Vertex::partial().with_surface_form(from),
|
||||||
Vertex::partial().with_surface_form(to),
|
Vertex::partial().with_surface_form(to),
|
||||||
]))
|
])
|
||||||
.update_as_line_segment()
|
.update_as_line_segment()
|
||||||
.build(self.objects)
|
.build(self.objects)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -149,10 +149,10 @@ impl<'a> ShellBuilder<'a> {
|
||||||
|
|
||||||
HalfEdge::partial()
|
HalfEdge::partial()
|
||||||
.with_curve(curve)
|
.with_curve(curve)
|
||||||
.with_vertices(Some([
|
.with_vertices([
|
||||||
Vertex::partial().with_surface_form(from),
|
Vertex::partial().with_surface_form(from),
|
||||||
Vertex::partial().with_surface_form(to),
|
Vertex::partial().with_surface_form(to),
|
||||||
]))
|
])
|
||||||
.update_as_line_segment()
|
.update_as_line_segment()
|
||||||
.build(self.objects)
|
.build(self.objects)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -175,7 +175,7 @@ impl<'a> ShellBuilder<'a> {
|
||||||
let to = Vertex::partial().with_surface_form(to);
|
let to = Vertex::partial().with_surface_form(to);
|
||||||
|
|
||||||
HalfEdge::partial()
|
HalfEdge::partial()
|
||||||
.with_vertices(Some([from, to]))
|
.with_vertices([from, to])
|
||||||
.update_as_line_segment()
|
.update_as_line_segment()
|
||||||
.build(self.objects)
|
.build(self.objects)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -251,7 +251,7 @@ impl<'a> ShellBuilder<'a> {
|
||||||
|
|
||||||
edges.push(
|
edges.push(
|
||||||
HalfEdge::partial()
|
HalfEdge::partial()
|
||||||
.with_vertices(Some(vertices))
|
.with_vertices(vertices)
|
||||||
.with_global_form(Some(edge.global_form().clone()))
|
.with_global_form(Some(edge.global_form().clone()))
|
||||||
.update_as_line_segment()
|
.update_as_line_segment()
|
||||||
.build(self.objects)
|
.build(self.objects)
|
||||||
|
|
|
@ -98,12 +98,9 @@ impl PartialHalfEdge {
|
||||||
/// Update the partial half-edge with the given vertices
|
/// Update the partial half-edge with the given vertices
|
||||||
pub fn with_vertices(
|
pub fn with_vertices(
|
||||||
mut self,
|
mut self,
|
||||||
vertices: Option<[impl Into<MaybePartial<Vertex>>; 2]>,
|
vertices: [impl Into<MaybePartial<Vertex>>; 2],
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let vertices = vertices.map(|vertices| vertices.map(Into::into));
|
self.vertices = vertices.map(Into::into);
|
||||||
if let Some([back, front]) = vertices {
|
|
||||||
self.vertices = [back, front];
|
|
||||||
}
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue