From 37cd83d48bab26b18f7988c519f3150456f51b93 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 29 Apr 2024 14:35:06 +0200 Subject: [PATCH] Expect `CurveBoundary` in `BuildHalfEdge` method This is preparation for moving some of the code of that method into a new, resuable method on `CurveBoundary`. --- crates/fj-core/src/operations/build/half_edge.rs | 16 +++++++--------- crates/fj-core/src/operations/build/shell.rs | 2 +- crates/fj-core/src/operations/sweep/half_edge.rs | 3 ++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/crates/fj-core/src/operations/build/half_edge.rs b/crates/fj-core/src/operations/build/half_edge.rs index 8ba8b3008..18a9353cf 100644 --- a/crates/fj-core/src/operations/build/half_edge.rs +++ b/crates/fj-core/src/operations/build/half_edge.rs @@ -2,7 +2,7 @@ use fj_interop::ext::ArrayExt; use fj_math::{Arc, Point, Scalar}; use crate::{ - geometry::{HalfEdgeGeom, LocalCurveGeom, SurfacePath}, + geometry::{CurveBoundary, HalfEdgeGeom, LocalCurveGeom, SurfacePath}, operations::{geometry::UpdateHalfEdgeGeometry, insert::Insert}, storage::Handle, topology::{Curve, HalfEdge, Surface, Vertex}, @@ -111,14 +111,15 @@ pub trait BuildHalfEdge { /// Create a line segment fn line_segment( points_surface: [impl Into>; 2], - boundary: Option<[Point<1>; 2]>, + boundary: Option>>, surface: Handle, core: &mut Core, ) -> Handle { - let boundary = - boundary.unwrap_or_else(|| [[0.], [1.]].map(Point::from)); + let boundary = boundary.unwrap_or_else(|| CurveBoundary { + inner: [[0.], [1.]].map(Point::from), + }); let path = SurfacePath::line_from_points_with_coords( - boundary.zip_ext(points_surface), + boundary.inner.zip_ext(points_surface), ); let half_edge = HalfEdge::unjoined(core).insert(core); @@ -130,10 +131,7 @@ pub trait BuildHalfEdge { ); core.layers.geometry.define_half_edge( half_edge.clone(), - HalfEdgeGeom { - path, - boundary: boundary.into(), - }, + HalfEdgeGeom { path, boundary }, ); half_edge diff --git a/crates/fj-core/src/operations/build/shell.rs b/crates/fj-core/src/operations/build/shell.rs index c93427a47..fcb3ee4b2 100644 --- a/crates/fj-core/src/operations/build/shell.rs +++ b/crates/fj-core/src/operations/build/shell.rs @@ -94,7 +94,7 @@ pub trait BuildShell { .map(|((vertex, positions), (curve, boundary))| { let half_edge = HalfEdge::line_segment( positions, - Some(boundary.reverse().inner), + Some(boundary.reverse()), surface.clone(), core, ); diff --git a/crates/fj-core/src/operations/sweep/half_edge.rs b/crates/fj-core/src/operations/sweep/half_edge.rs index a92056f88..64a80adcd 100644 --- a/crates/fj-core/src/operations/sweep/half_edge.rs +++ b/crates/fj-core/src/operations/sweep/half_edge.rs @@ -2,6 +2,7 @@ use fj_interop::{ext::ArrayExt, Color}; use fj_math::{Point, Scalar, Vector}; use crate::{ + geometry::CurveBoundary, operations::{ build::{BuildCycle, BuildHalfEdge}, geometry::UpdateHalfEdgeGeometry, @@ -121,7 +122,7 @@ impl SweepHalfEdge for Handle { let half_edge = { let line_segment = HalfEdge::line_segment( [start, end], - Some(boundary), + Some(CurveBoundary { inner: boundary }), surface.clone(), core, );