Expect CurveBoundary in BuildHalfEdge method

This is preparation for moving some of the code of that method into a
new, resuable method on `CurveBoundary`.
This commit is contained in:
Hanno Braun 2024-04-29 14:35:06 +02:00
parent 0e664024ad
commit 37cd83d48b
3 changed files with 10 additions and 11 deletions

View File

@ -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<Point<2>>; 2],
boundary: Option<[Point<1>; 2]>,
boundary: Option<CurveBoundary<Point<1>>>,
surface: Handle<Surface>,
core: &mut Core,
) -> Handle<HalfEdge> {
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

View File

@ -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,
);

View File

@ -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<HalfEdge> {
let half_edge = {
let line_segment = HalfEdge::line_segment(
[start, end],
Some(boundary),
Some(CurveBoundary { inner: boundary }),
surface.clone(),
core,
);