mirror of https://github.com/hannobraun/Fornjot
Simplify `PartialHalfEdge::with_back_vertex`
This commit is contained in:
parent
162aba8caa
commit
e2ddd014b1
|
@ -208,7 +208,8 @@ mod tests {
|
|||
let face =
|
||||
(half_edge, Color::default()).sweep([0., 0., 1.], &objects)?;
|
||||
|
||||
let expected_face = {
|
||||
let expected_face =
|
||||
{
|
||||
let surface = objects.surfaces.xz_plane();
|
||||
|
||||
let bottom = HalfEdge::partial()
|
||||
|
@ -219,10 +220,8 @@ mod tests {
|
|||
.build(&objects)?;
|
||||
let side_up = HalfEdge::partial()
|
||||
.with_surface(Some(surface.clone()))
|
||||
.with_back_vertex(Some(
|
||||
Vertex::partial().with_surface_form(
|
||||
.with_back_vertex(Vertex::partial().with_surface_form(
|
||||
bottom.front().surface_form().clone(),
|
||||
),
|
||||
))
|
||||
.with_front_vertex(Vertex::partial().with_surface_form(
|
||||
SurfaceVertex::partial().with_position(Some([1., 1.])),
|
||||
|
@ -231,28 +230,24 @@ mod tests {
|
|||
.build(&objects)?;
|
||||
let top = HalfEdge::partial()
|
||||
.with_surface(Some(surface.clone()))
|
||||
.with_back_vertex(Some(Vertex::partial().with_surface_form(
|
||||
.with_back_vertex(Vertex::partial().with_surface_form(
|
||||
SurfaceVertex::partial().with_position(Some([0., 1.])),
|
||||
)))
|
||||
.with_front_vertex(
|
||||
Vertex::partial().with_surface_form(
|
||||
))
|
||||
.with_front_vertex(Vertex::partial().with_surface_form(
|
||||
side_up.front().surface_form().clone(),
|
||||
),
|
||||
)
|
||||
))
|
||||
.update_as_line_segment()
|
||||
.build(&objects)?
|
||||
.reverse(&objects)?;
|
||||
let side_down = HalfEdge::partial()
|
||||
let side_down =
|
||||
HalfEdge::partial()
|
||||
.with_surface(Some(surface))
|
||||
.with_back_vertex(Some(
|
||||
Vertex::partial().with_surface_form(
|
||||
.with_back_vertex(Vertex::partial().with_surface_form(
|
||||
bottom.back().surface_form().clone(),
|
||||
),
|
||||
))
|
||||
.with_front_vertex(
|
||||
Vertex::partial()
|
||||
.with_surface_form(top.front().surface_form().clone()),
|
||||
)
|
||||
.with_front_vertex(Vertex::partial().with_surface_form(
|
||||
top.front().surface_form().clone(),
|
||||
))
|
||||
.update_as_line_segment()
|
||||
.build(&objects)?
|
||||
.reverse(&objects)?;
|
||||
|
|
|
@ -118,7 +118,7 @@ impl PartialCycle {
|
|||
partial.with_surface_form(previous_vertex)
|
||||
});
|
||||
|
||||
half_edge.with_back_vertex(Some(back))
|
||||
half_edge.with_back_vertex(back)
|
||||
})
|
||||
.into_full(objects)?;
|
||||
|
||||
|
|
|
@ -82,12 +82,11 @@ impl PartialHalfEdge {
|
|||
/// Update the partial half-edge with the given back vertex
|
||||
pub fn with_back_vertex(
|
||||
mut self,
|
||||
vertex: Option<impl Into<MaybePartial<Vertex>>>,
|
||||
vertex: impl Into<MaybePartial<Vertex>>,
|
||||
) -> Self {
|
||||
if let Some(vertex) = vertex {
|
||||
let [from, _] = &mut self.vertices;
|
||||
*from = vertex.into();
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue