Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PartialVertex #1527

Merged
merged 8 commits into from
Jan 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Inline VertexBuilder::replace_surface
hannobraun committed Jan 20, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 3be341c02b7d4a3616c9700a87126fd0914c494e
4 changes: 2 additions & 2 deletions crates/fj-kernel/src/builder/edge.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ use crate::{
partial::{MaybeSurfacePath, Partial, PartialGlobalEdge, PartialHalfEdge},
};

use super::{CurveBuilder, VertexBuilder};
use super::CurveBuilder;

/// Builder API for [`PartialHalfEdge`]
pub trait HalfEdgeBuilder {
@@ -61,7 +61,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
self.curve.write().surface = surface.clone();

for vertex in &mut self.vertices {
vertex.replace_surface(surface.clone());
vertex.surface_form.write().surface = surface.clone();
}
}

26 changes: 4 additions & 22 deletions crates/fj-kernel/src/builder/vertex.rs
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
use fj_math::Point;

use crate::{
objects::Surface,
partial::{
Partial, PartialGlobalVertex, PartialSurfaceVertex, PartialVertex,
},
use crate::partial::{
PartialGlobalVertex, PartialSurfaceVertex, PartialVertex,
};

/// Builder API for [`PartialVertex`]
pub trait VertexBuilder {
/// Completely replace the surface in this vertex' object graph
///
/// Please note that this operation will write to every partial object that
/// the vertex 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>>);
}
pub trait VertexBuilder {}

impl VertexBuilder for PartialVertex {
fn replace_surface(&mut self, surface: impl Into<Partial<Surface>>) {
let surface = surface.into();
self.surface_form.write().surface = surface;
}
}
impl VertexBuilder for PartialVertex {}

/// Builder API for [`PartialSurfaceVertex`]
pub trait SurfaceVertexBuilder {