mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-14 19:25:52 +00:00
Remove HalfEdgeBuilder::replace_surface
Thanks to the recent simplifications, it was no longer carrying its weight.
This commit is contained in:
parent
d8f6a691da
commit
c55abb0f9c
@ -196,8 +196,10 @@ mod tests {
|
||||
half_edge
|
||||
};
|
||||
let side_up = {
|
||||
let mut side_up = PartialHalfEdge::default();
|
||||
side_up.replace_surface(surface.clone());
|
||||
let mut side_up = PartialHalfEdge {
|
||||
surface: surface.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
{
|
||||
let [back, front] = side_up
|
||||
@ -217,8 +219,10 @@ mod tests {
|
||||
side_up
|
||||
};
|
||||
let top = {
|
||||
let mut top = PartialHalfEdge::default();
|
||||
top.replace_surface(surface.clone());
|
||||
let mut top = PartialHalfEdge {
|
||||
surface: surface.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
{
|
||||
let [(back, back_surface), (front, front_surface)] =
|
||||
@ -243,8 +247,10 @@ mod tests {
|
||||
.clone()
|
||||
};
|
||||
let side_down = {
|
||||
let mut side_down = PartialHalfEdge::default();
|
||||
side_down.replace_surface(surface);
|
||||
let mut side_down = PartialHalfEdge {
|
||||
surface,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let [(back, back_surface), (front, front_surface)] =
|
||||
side_down.vertices.each_mut_ext();
|
||||
|
@ -149,7 +149,7 @@ impl CycleBuilder for PartialCycle {
|
||||
|
||||
let [_, vertex] = &mut new_half_edge.vertices;
|
||||
vertex.1 = shared_surface_vertex;
|
||||
new_half_edge.replace_surface(self.surface.clone());
|
||||
new_half_edge.surface = self.surface.clone();
|
||||
new_half_edge.infer_global_form();
|
||||
}
|
||||
|
||||
|
@ -11,16 +11,6 @@ use super::CurveBuilder;
|
||||
|
||||
/// Builder API for [`PartialHalfEdge`]
|
||||
pub trait HalfEdgeBuilder {
|
||||
/// Completely replace the surface in this half-edge's object graph
|
||||
///
|
||||
/// Please note that this operation will write to both vertices that the
|
||||
/// half-edge references. If any of them were created from full objects,
|
||||
/// this will break the connection to those, meaning that building the
|
||||
/// partial objects won't result in those full objects again. This will be
|
||||
/// the case, even if those full objects already referenced the provided
|
||||
/// surface.
|
||||
fn replace_surface(&mut self, surface: impl Into<Partial<Surface>>);
|
||||
|
||||
/// Update partial half-edge to be a circle, from the given radius
|
||||
fn update_as_circle_from_radius(&mut self, radius: impl Into<Scalar>);
|
||||
|
||||
@ -61,12 +51,6 @@ pub trait HalfEdgeBuilder {
|
||||
}
|
||||
|
||||
impl HalfEdgeBuilder for PartialHalfEdge {
|
||||
fn replace_surface(&mut self, surface: impl Into<Partial<Surface>>) {
|
||||
let surface = surface.into();
|
||||
|
||||
self.surface = surface;
|
||||
}
|
||||
|
||||
fn update_as_circle_from_radius(&mut self, radius: impl Into<Scalar>) {
|
||||
let path = self.curve.write().update_as_circle_from_radius(radius);
|
||||
|
||||
@ -130,7 +114,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
||||
surface: impl Into<Partial<Surface>>,
|
||||
points: [impl Into<Point<2>>; 2],
|
||||
) {
|
||||
self.replace_surface(surface.into());
|
||||
self.surface = surface.into();
|
||||
|
||||
for (vertex, point) in self.vertices.each_mut_ext().zip_ext(points) {
|
||||
let mut surface_form = vertex.1.write();
|
||||
|
@ -30,8 +30,10 @@ impl Shape for fj::Sketch {
|
||||
let half_edge = {
|
||||
let surface = Partial::from(surface);
|
||||
|
||||
let mut half_edge = PartialHalfEdge::default();
|
||||
half_edge.replace_surface(surface);
|
||||
let mut half_edge = PartialHalfEdge {
|
||||
surface,
|
||||
..Default::default()
|
||||
};
|
||||
half_edge.update_as_circle_from_radius(circle.radius());
|
||||
|
||||
Partial::from_partial(half_edge)
|
||||
|
Loading…
Reference in New Issue
Block a user