mirror of https://github.com/hannobraun/Fornjot
Simplify `PartialHalfEdge::with_surface`
This commit is contained in:
parent
3278ae73ad
commit
076400632c
|
@ -219,7 +219,7 @@ mod tests {
|
|||
)
|
||||
.build(&objects)?;
|
||||
let side_up = HalfEdge::partial()
|
||||
.with_surface(Some(surface.clone()))
|
||||
.with_surface(surface.clone())
|
||||
.with_back_vertex(Vertex::partial().with_surface_form(
|
||||
bottom.front().surface_form().clone(),
|
||||
))
|
||||
|
@ -229,7 +229,7 @@ mod tests {
|
|||
.update_as_line_segment()
|
||||
.build(&objects)?;
|
||||
let top = HalfEdge::partial()
|
||||
.with_surface(Some(surface.clone()))
|
||||
.with_surface(surface.clone())
|
||||
.with_back_vertex(Vertex::partial().with_surface_form(
|
||||
SurfaceVertex::partial().with_position(Some([0., 1.])),
|
||||
))
|
||||
|
@ -241,7 +241,7 @@ mod tests {
|
|||
.reverse(&objects)?;
|
||||
let side_down =
|
||||
HalfEdge::partial()
|
||||
.with_surface(Some(surface))
|
||||
.with_surface(surface)
|
||||
.with_back_vertex(Vertex::partial().with_surface_form(
|
||||
bottom.back().surface_form().clone(),
|
||||
))
|
||||
|
|
|
@ -97,7 +97,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||
Vertex::partial().with_surface_form(surface_form)
|
||||
});
|
||||
|
||||
self.with_surface(Some(surface))
|
||||
self.with_surface(surface)
|
||||
.with_vertices(Some(vertices))
|
||||
.update_as_line_segment()
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ impl PartialCycle {
|
|||
if let Some(surface) = surface {
|
||||
for half_edge in &mut self.half_edges {
|
||||
*half_edge = half_edge.clone().update_partial(|half_edge| {
|
||||
half_edge.with_surface(Some(surface.clone()))
|
||||
half_edge.with_surface(surface.clone())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,24 +47,22 @@ impl PartialHalfEdge {
|
|||
}
|
||||
|
||||
/// Update the partial half-edge with the given surface
|
||||
pub fn with_surface(mut self, surface: Option<Handle<Surface>>) -> Self {
|
||||
if let Some(surface) = surface {
|
||||
self.curve = self.curve.update_partial(|curve| {
|
||||
curve.with_surface(Some(surface.clone()))
|
||||
});
|
||||
pub fn with_surface(mut self, surface: Handle<Surface>) -> Self {
|
||||
self.curve = self
|
||||
.curve
|
||||
.update_partial(|curve| curve.with_surface(Some(surface.clone())));
|
||||
|
||||
self.vertices = self.vertices.map(|vertex| {
|
||||
vertex.update_partial(|vertex| {
|
||||
let surface_form = vertex.surface_form().update_partial(
|
||||
|surface_vertex| {
|
||||
let surface_form =
|
||||
vertex.surface_form().update_partial(|surface_vertex| {
|
||||
surface_vertex.with_surface(Some(surface.clone()))
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
vertex.with_surface_form(surface_form)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ impl Shape for fj::Sketch {
|
|||
// none need to be added here.
|
||||
|
||||
let half_edge = HalfEdge::partial()
|
||||
.with_surface(Some(surface))
|
||||
.with_surface(surface)
|
||||
.update_as_circle_from_radius(circle.radius(), objects)?
|
||||
.build(objects)?;
|
||||
let cycle = objects.cycles.insert(Cycle::new([half_edge]))?;
|
||||
|
|
Loading…
Reference in New Issue