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

Unify Vertex and PartialVertex #1648

Merged
merged 4 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions crates/fj-kernel/src/algorithms/sweep/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
builder::{CycleBuilder, HalfEdgeBuilder},
insert::Insert,
objects::{Face, HalfEdge, Objects, Surface, Vertex},
partial::{Partial, PartialFace, PartialObject},
partial::{PartialFace, PartialObject},
services::Service,
storage::Handle,
};
Expand Down Expand Up @@ -97,7 +97,7 @@ impl Sweep for (Handle<HalfEdge>, &Handle<Vertex>, &Surface, Color) {
// Writing to the start vertices is enough. Neighboring half-
// edges share surface vertices, so writing the start vertex of
// each half-edge writes to all vertices.
half_edge.start_vertex = Partial::from(global_vertex);
half_edge.start_vertex = global_vertex;
});

// With the vertices set, we can now update the curves.
Expand Down
2 changes: 0 additions & 2 deletions crates/fj-kernel/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ mod face;
mod shell;
mod sketch;
mod solid;
mod vertex;

use std::array;

pub use self::{
cycle::CycleBuilder, edge::HalfEdgeBuilder, face::FaceBuilder,
shell::ShellBuilder, sketch::SketchBuilder, solid::SolidBuilder,
vertex::VertexBuilder,
};

/// Pass objects to a builder method
Expand Down
9 changes: 0 additions & 9 deletions crates/fj-kernel/src/builder/vertex.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/fj-kernel/src/partial/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub use self::{
shell::PartialShell,
sketch::PartialSketch,
solid::PartialSolid,
vertex::PartialVertex,
},
traits::{HasPartial, PartialObject},
wrapper::{FullToPartialCache, Partial},
Expand Down
21 changes: 7 additions & 14 deletions crates/fj-kernel/src/partial/objects/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
geometry::curve::Curve,
insert::Insert,
objects::{GlobalEdge, HalfEdge, Objects, Vertex},
partial::{FullToPartialCache, Partial, PartialObject},
partial::{FullToPartialCache, PartialObject},
services::Service,
storage::Handle,
};
Expand All @@ -19,7 +19,7 @@ pub struct PartialHalfEdge {
pub boundary: [Option<Point<1>>; 2],

/// The surface vertex where the half-edge starts
pub start_vertex: Partial<Vertex>,
pub start_vertex: Handle<Vertex>,

/// The global form of the half-edge
pub global_form: Handle<GlobalEdge>,
Expand Down Expand Up @@ -52,27 +52,21 @@ impl PartialObject for PartialHalfEdge {
Self {
curve: None,
boundary: [None; 2],
start_vertex: Partial::new(objects),
start_vertex: Vertex::new().insert(objects),
global_form: GlobalEdge::new().insert(objects),
}
}

fn from_full(
half_edge: &Self::Full,
cache: &mut FullToPartialCache,
) -> Self {
fn from_full(half_edge: &Self::Full, _: &mut FullToPartialCache) -> Self {
Self {
curve: Some(half_edge.curve().into()),
boundary: half_edge.boundary().map(Some),
start_vertex: Partial::from_full(
half_edge.start_vertex().clone(),
cache,
),
start_vertex: half_edge.start_vertex().clone(),
global_form: half_edge.global_form().clone(),
}
}

fn build(self, objects: &mut Service<Objects>) -> Self::Full {
fn build(self, _: &mut Service<Objects>) -> Self::Full {
let curve = match self.curve.expect("Need path to build curve") {
MaybeCurve::Defined(path) => path,
undefined => {
Expand All @@ -84,9 +78,8 @@ impl PartialObject for PartialHalfEdge {
let boundary = self.boundary.map(|point| {
point.expect("Can't build `HalfEdge` without boundary positions")
});
let start_vertex = self.start_vertex.build(objects);

HalfEdge::new(curve, boundary, start_vertex, self.global_form)
HalfEdge::new(curve, boundary, self.start_vertex, self.global_form)
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/fj-kernel/src/partial/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ pub mod face;
pub mod shell;
pub mod sketch;
pub mod solid;
pub mod vertex;
25 changes: 0 additions & 25 deletions crates/fj-kernel/src/partial/objects/vertex.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/fj-kernel/src/partial/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ impl_trait!(
Shell, PartialShell;
Sketch, PartialSketch;
Solid, PartialSolid;
Vertex, PartialVertex;
);