mirror of https://github.com/hannobraun/Fornjot
Simplify `PartialHalfEdge::with_front_vertex`
This commit is contained in:
parent
5c4d56c8dc
commit
162aba8caa
|
@ -224,9 +224,9 @@ mod tests {
|
|||
bottom.front().surface_form().clone(),
|
||||
),
|
||||
))
|
||||
.with_front_vertex(Some(Vertex::partial().with_surface_form(
|
||||
.with_front_vertex(Vertex::partial().with_surface_form(
|
||||
SurfaceVertex::partial().with_position(Some([1., 1.])),
|
||||
)))
|
||||
))
|
||||
.update_as_line_segment()
|
||||
.build(&objects)?;
|
||||
let top = HalfEdge::partial()
|
||||
|
@ -234,11 +234,11 @@ mod tests {
|
|||
.with_back_vertex(Some(Vertex::partial().with_surface_form(
|
||||
SurfaceVertex::partial().with_position(Some([0., 1.])),
|
||||
)))
|
||||
.with_front_vertex(Some(
|
||||
.with_front_vertex(
|
||||
Vertex::partial().with_surface_form(
|
||||
side_up.front().surface_form().clone(),
|
||||
),
|
||||
))
|
||||
)
|
||||
.update_as_line_segment()
|
||||
.build(&objects)?
|
||||
.reverse(&objects)?;
|
||||
|
@ -249,10 +249,10 @@ mod tests {
|
|||
bottom.back().surface_form().clone(),
|
||||
),
|
||||
))
|
||||
.with_front_vertex(Some(
|
||||
.with_front_vertex(
|
||||
Vertex::partial()
|
||||
.with_surface_form(top.front().surface_form().clone()),
|
||||
))
|
||||
)
|
||||
.update_as_line_segment()
|
||||
.build(&objects)?
|
||||
.reverse(&objects)?;
|
||||
|
|
|
@ -97,10 +97,10 @@ impl PartialCycle {
|
|||
last_half_edge.front().surface_form().into_full(objects)?;
|
||||
|
||||
*last_half_edge = last_half_edge.clone().merge_with(
|
||||
PartialHalfEdge::default().with_front_vertex(Some(
|
||||
PartialHalfEdge::default().with_front_vertex(
|
||||
PartialVertex::default()
|
||||
.with_surface_form(surface_vertex.clone()),
|
||||
)),
|
||||
),
|
||||
);
|
||||
|
||||
surface_vertex
|
||||
|
|
|
@ -94,12 +94,11 @@ impl PartialHalfEdge {
|
|||
/// Update the partial half-edge with the given front vertex
|
||||
pub fn with_front_vertex(
|
||||
mut self,
|
||||
vertex: Option<impl Into<MaybePartial<Vertex>>>,
|
||||
vertex: impl Into<MaybePartial<Vertex>>,
|
||||
) -> Self {
|
||||
if let Some(vertex) = vertex {
|
||||
let [_, to] = &mut self.vertices;
|
||||
*to = vertex.into();
|
||||
}
|
||||
let [_, to] = &mut self.vertices;
|
||||
*to = vertex.into();
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue