mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-13 06:18:27 +00:00
commit
605001938a
@ -60,13 +60,13 @@ impl SweepCycle for Cycle {
|
|||||||
let path = path.into();
|
let path = path.into();
|
||||||
|
|
||||||
let mut faces = Vec::new();
|
let mut faces = Vec::new();
|
||||||
let mut top_edges = Vec::new();
|
let mut top_half_edges = Vec::new();
|
||||||
|
|
||||||
for bottom_half_edge_pair in self.half_edges().pairs() {
|
for bottom_half_edge_pair in self.half_edges().pairs() {
|
||||||
let (bottom_half_edge, bottom_half_edge_next) =
|
let (bottom_half_edge, bottom_half_edge_next) =
|
||||||
bottom_half_edge_pair;
|
bottom_half_edge_pair;
|
||||||
|
|
||||||
let (side_face, top_half_edge) = bottom_half_edge.sweep_half_edge(
|
let swept_half_edge = bottom_half_edge.sweep_half_edge(
|
||||||
bottom_half_edge_next.start_vertex().clone(),
|
bottom_half_edge_next.start_vertex().clone(),
|
||||||
bottom_surface.clone(),
|
bottom_surface.clone(),
|
||||||
color,
|
color,
|
||||||
@ -75,10 +75,10 @@ impl SweepCycle for Cycle {
|
|||||||
core,
|
core,
|
||||||
);
|
);
|
||||||
|
|
||||||
faces.push(side_face);
|
faces.push(swept_half_edge.face);
|
||||||
|
|
||||||
top_edges.push((
|
top_half_edges.push((
|
||||||
top_half_edge,
|
swept_half_edge.top_half_edge,
|
||||||
*core.layers.geometry.of_half_edge(bottom_half_edge),
|
*core.layers.geometry.of_half_edge(bottom_half_edge),
|
||||||
core.layers
|
core.layers
|
||||||
.geometry
|
.geometry
|
||||||
@ -91,7 +91,7 @@ impl SweepCycle for Cycle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let top_cycle =
|
let top_cycle =
|
||||||
Cycle::empty().add_joined_edges(top_edges, top_surface, core);
|
Cycle::empty().add_joined_edges(top_half_edges, top_surface, core);
|
||||||
|
|
||||||
SweptCycle { faces, top_cycle }
|
SweptCycle { faces, top_cycle }
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ pub trait SweepHalfEdge {
|
|||||||
path: impl Into<Vector<3>>,
|
path: impl Into<Vector<3>>,
|
||||||
cache: &mut SweepCache,
|
cache: &mut SweepCache,
|
||||||
core: &mut Core,
|
core: &mut Core,
|
||||||
) -> (Face, Handle<HalfEdge>);
|
) -> SweptHalfEdge;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SweepHalfEdge for Handle<HalfEdge> {
|
impl SweepHalfEdge for Handle<HalfEdge> {
|
||||||
@ -56,7 +56,7 @@ impl SweepHalfEdge for Handle<HalfEdge> {
|
|||||||
path: impl Into<Vector<3>>,
|
path: impl Into<Vector<3>>,
|
||||||
cache: &mut SweepCache,
|
cache: &mut SweepCache,
|
||||||
core: &mut Core,
|
core: &mut Core,
|
||||||
) -> (Face, Handle<HalfEdge>) {
|
) -> SweptHalfEdge {
|
||||||
let path = path.into();
|
let path = path.into();
|
||||||
|
|
||||||
let half_edge_geom = *core.layers.geometry.of_half_edge(self);
|
let half_edge_geom = *core.layers.geometry.of_half_edge(self);
|
||||||
@ -161,6 +161,20 @@ impl SweepHalfEdge for Handle<HalfEdge> {
|
|||||||
|
|
||||||
let face = Face::new(surface, region);
|
let face = Face::new(surface, region);
|
||||||
|
|
||||||
(face, edge_top)
|
SweptHalfEdge {
|
||||||
|
face,
|
||||||
|
top_half_edge: edge_top,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The result of sweeping a [`HalfEdge`]
|
||||||
|
///
|
||||||
|
/// See [`SweepHalfEdge`].
|
||||||
|
pub struct SweptHalfEdge {
|
||||||
|
/// The face created by sweeping the half-edge
|
||||||
|
pub face: Face,
|
||||||
|
|
||||||
|
/// The top half-edge of the created face
|
||||||
|
pub top_half_edge: Handle<HalfEdge>,
|
||||||
|
}
|
||||||
|
@ -15,7 +15,7 @@ mod vertex;
|
|||||||
pub use self::{
|
pub use self::{
|
||||||
cycle::{SweepCycle, SweptCycle},
|
cycle::{SweepCycle, SweptCycle},
|
||||||
face::SweepFace,
|
face::SweepFace,
|
||||||
half_edge::SweepHalfEdge,
|
half_edge::{SweepHalfEdge, SweptHalfEdge},
|
||||||
path::SweepSurfacePath,
|
path::SweepSurfacePath,
|
||||||
region::{SweepRegion, SweptRegion},
|
region::{SweepRegion, SweptRegion},
|
||||||
shell_face::{ShellExtendedBySweep, SweepFaceOfShell},
|
shell_face::{ShellExtendedBySweep, SweepFaceOfShell},
|
||||||
|
Loading…
Reference in New Issue
Block a user