mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-15 11:45:54 +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
|
half_edge
|
||||||
};
|
};
|
||||||
let side_up = {
|
let side_up = {
|
||||||
let mut side_up = PartialHalfEdge::default();
|
let mut side_up = PartialHalfEdge {
|
||||||
side_up.replace_surface(surface.clone());
|
surface: surface.clone(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
let [back, front] = side_up
|
let [back, front] = side_up
|
||||||
@ -217,8 +219,10 @@ mod tests {
|
|||||||
side_up
|
side_up
|
||||||
};
|
};
|
||||||
let top = {
|
let top = {
|
||||||
let mut top = PartialHalfEdge::default();
|
let mut top = PartialHalfEdge {
|
||||||
top.replace_surface(surface.clone());
|
surface: surface.clone(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
let [(back, back_surface), (front, front_surface)] =
|
let [(back, back_surface), (front, front_surface)] =
|
||||||
@ -243,8 +247,10 @@ mod tests {
|
|||||||
.clone()
|
.clone()
|
||||||
};
|
};
|
||||||
let side_down = {
|
let side_down = {
|
||||||
let mut side_down = PartialHalfEdge::default();
|
let mut side_down = PartialHalfEdge {
|
||||||
side_down.replace_surface(surface);
|
surface,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
let [(back, back_surface), (front, front_surface)] =
|
let [(back, back_surface), (front, front_surface)] =
|
||||||
side_down.vertices.each_mut_ext();
|
side_down.vertices.each_mut_ext();
|
||||||
|
@ -149,7 +149,7 @@ impl CycleBuilder for PartialCycle {
|
|||||||
|
|
||||||
let [_, vertex] = &mut new_half_edge.vertices;
|
let [_, vertex] = &mut new_half_edge.vertices;
|
||||||
vertex.1 = shared_surface_vertex;
|
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();
|
new_half_edge.infer_global_form();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,16 +11,6 @@ use super::CurveBuilder;
|
|||||||
|
|
||||||
/// Builder API for [`PartialHalfEdge`]
|
/// Builder API for [`PartialHalfEdge`]
|
||||||
pub trait HalfEdgeBuilder {
|
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
|
/// Update partial half-edge to be a circle, from the given radius
|
||||||
fn update_as_circle_from_radius(&mut self, radius: impl Into<Scalar>);
|
fn update_as_circle_from_radius(&mut self, radius: impl Into<Scalar>);
|
||||||
|
|
||||||
@ -61,12 +51,6 @@ pub trait HalfEdgeBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl HalfEdgeBuilder for PartialHalfEdge {
|
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>) {
|
fn update_as_circle_from_radius(&mut self, radius: impl Into<Scalar>) {
|
||||||
let path = self.curve.write().update_as_circle_from_radius(radius);
|
let path = self.curve.write().update_as_circle_from_radius(radius);
|
||||||
|
|
||||||
@ -130,7 +114,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||||||
surface: impl Into<Partial<Surface>>,
|
surface: impl Into<Partial<Surface>>,
|
||||||
points: [impl Into<Point<2>>; 2],
|
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) {
|
for (vertex, point) in self.vertices.each_mut_ext().zip_ext(points) {
|
||||||
let mut surface_form = vertex.1.write();
|
let mut surface_form = vertex.1.write();
|
||||||
|
@ -30,8 +30,10 @@ impl Shape for fj::Sketch {
|
|||||||
let half_edge = {
|
let half_edge = {
|
||||||
let surface = Partial::from(surface);
|
let surface = Partial::from(surface);
|
||||||
|
|
||||||
let mut half_edge = PartialHalfEdge::default();
|
let mut half_edge = PartialHalfEdge {
|
||||||
half_edge.replace_surface(surface);
|
surface,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
half_edge.update_as_circle_from_radius(circle.radius());
|
half_edge.update_as_circle_from_radius(circle.radius());
|
||||||
|
|
||||||
Partial::from_partial(half_edge)
|
Partial::from_partial(half_edge)
|
||||||
|
Loading…
Reference in New Issue
Block a user