Merge pull request #2299 from hannobraun/geometry

Provide `Handle<Surface>` to sweep code
This commit is contained in:
Hanno Braun 2024-03-26 12:40:20 +01:00 committed by GitHub
commit 8b21004c00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 20 deletions

View File

@ -50,7 +50,7 @@ impl AddHole for Shell {
core,
)
.sweep_region(
location.face.surface(),
location.face.surface().clone(),
None,
path,
&mut SweepCache::default(),
@ -113,7 +113,7 @@ impl AddHole for Shell {
core,
)
.sweep_region(
entry_location.face.surface(),
entry_location.face.surface().clone(),
None,
path,
&mut SweepCache::default(),

View File

@ -2,11 +2,11 @@ use fj_interop::Color;
use fj_math::Vector;
use crate::{
geometry::SurfaceGeometry,
operations::{
build::BuildCycle, join::JoinCycle, sweep::half_edge::SweepHalfEdge,
},
topology::{Cycle, Face},
storage::Handle,
topology::{Cycle, Face, Surface},
Core,
};
@ -38,7 +38,7 @@ pub trait SweepCycle {
/// operation is called in, and therefore falls outside of its scope.
fn sweep_cycle(
&self,
surface: &SurfaceGeometry,
surface: Handle<Surface>,
color: Option<Color>,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
@ -49,7 +49,7 @@ pub trait SweepCycle {
impl SweepCycle for Cycle {
fn sweep_cycle(
&self,
surface: &SurfaceGeometry,
surface: Handle<Surface>,
color: Option<Color>,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
@ -66,7 +66,7 @@ impl SweepCycle for Cycle {
let (side_face, top_edge) = bottom_half_edge.sweep_half_edge(
bottom_half_edge_next.start_vertex().clone(),
surface,
surface.clone(),
color,
path,
cache,

View File

@ -50,7 +50,7 @@ impl SweepFace for Handle<Face> {
let other_faces = bottom_face
.region()
.sweep_region(
bottom_face.surface(),
bottom_face.surface().clone(),
bottom_face.region().get_color(core),
path,
cache,

View File

@ -2,7 +2,6 @@ use fj_interop::{ext::ArrayExt, Color};
use fj_math::{Point, Scalar, Vector};
use crate::{
geometry::SurfaceGeometry,
operations::{
build::{BuildCycle, BuildHalfEdge},
geometry::UpdateHalfEdgeGeometry,
@ -11,7 +10,7 @@ use crate::{
update::{UpdateCycle, UpdateHalfEdge},
},
storage::Handle,
topology::{Cycle, Face, HalfEdge, Region, Vertex},
topology::{Cycle, Face, HalfEdge, Region, Surface, Vertex},
Core,
};
@ -39,7 +38,7 @@ pub trait SweepHalfEdge {
fn sweep_half_edge(
&self,
end_vertex: Handle<Vertex>,
surface: &SurfaceGeometry,
surface: Handle<Surface>,
color: Option<Color>,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
@ -51,7 +50,7 @@ impl SweepHalfEdge for Handle<HalfEdge> {
fn sweep_half_edge(
&self,
end_vertex: Handle<Vertex>,
surface: &SurfaceGeometry,
surface: Handle<Surface>,
color: Option<Color>,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
@ -60,7 +59,11 @@ impl SweepHalfEdge for Handle<HalfEdge> {
let path = path.into();
let geometry = core.layers.geometry.of_half_edge(self);
let surface = geometry.path.sweep_surface_path(surface, path, core);
let surface = geometry.path.sweep_surface_path(
&core.layers.geometry.of_surface(&surface),
path,
core,
);
// Next, we need to define the boundaries of the face. Let's start with
// the global vertices and edges.

View File

@ -2,7 +2,6 @@ use fj_interop::Color;
use fj_math::Vector;
use crate::{
geometry::SurfaceGeometry,
operations::{
insert::Insert, reverse::Reverse, transform::TransformObject,
},
@ -32,7 +31,7 @@ pub trait SweepRegion {
/// operation's scope.
fn sweep_region(
&self,
surface: &Handle<Surface>,
surface: Handle<Surface>,
color: Option<Color>,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
@ -43,7 +42,7 @@ pub trait SweepRegion {
impl SweepRegion for Region {
fn sweep_region(
&self,
surface: &Handle<Surface>,
surface: Handle<Surface>,
color: Option<Color>,
path: impl Into<Vector<3>>,
cache: &mut SweepCache,
@ -55,7 +54,7 @@ impl SweepRegion for Region {
let top_exterior = sweep_cycle(
self.exterior(),
&core.layers.geometry.of_surface(surface),
surface.clone(),
color,
&mut faces,
path,
@ -69,7 +68,7 @@ impl SweepRegion for Region {
.map(|bottom_cycle| {
sweep_cycle(
bottom_cycle,
&core.layers.geometry.of_surface(surface),
surface.clone(),
color,
&mut faces,
path,
@ -96,7 +95,7 @@ impl SweepRegion for Region {
fn sweep_cycle(
bottom_cycle: &Cycle,
bottom_surface: &SurfaceGeometry,
bottom_surface: Handle<Surface>,
color: Option<Color>,
faces: &mut Vec<Face>,
path: Vector<3>,

View File

@ -66,7 +66,7 @@ impl SweepFaceOfShell for Shell {
.derive_from(face.region().exterior(), core);
let region = Region::new(exterior, []);
let swept_region = region.sweep_region(
face.surface(),
face.surface().clone(),
face.region().get_color(core),
path,
&mut cache,