mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-10 04:48:29 +00:00
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:
parent
0e664024ad
commit
37cd83d48b
@ -2,7 +2,7 @@ use fj_interop::ext::ArrayExt;
|
|||||||
use fj_math::{Arc, Point, Scalar};
|
use fj_math::{Arc, Point, Scalar};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
geometry::{HalfEdgeGeom, LocalCurveGeom, SurfacePath},
|
geometry::{CurveBoundary, HalfEdgeGeom, LocalCurveGeom, SurfacePath},
|
||||||
operations::{geometry::UpdateHalfEdgeGeometry, insert::Insert},
|
operations::{geometry::UpdateHalfEdgeGeometry, insert::Insert},
|
||||||
storage::Handle,
|
storage::Handle,
|
||||||
topology::{Curve, HalfEdge, Surface, Vertex},
|
topology::{Curve, HalfEdge, Surface, Vertex},
|
||||||
@ -111,14 +111,15 @@ pub trait BuildHalfEdge {
|
|||||||
/// Create a line segment
|
/// Create a line segment
|
||||||
fn line_segment(
|
fn line_segment(
|
||||||
points_surface: [impl Into<Point<2>>; 2],
|
points_surface: [impl Into<Point<2>>; 2],
|
||||||
boundary: Option<[Point<1>; 2]>,
|
boundary: Option<CurveBoundary<Point<1>>>,
|
||||||
surface: Handle<Surface>,
|
surface: Handle<Surface>,
|
||||||
core: &mut Core,
|
core: &mut Core,
|
||||||
) -> Handle<HalfEdge> {
|
) -> Handle<HalfEdge> {
|
||||||
let boundary =
|
let boundary = boundary.unwrap_or_else(|| CurveBoundary {
|
||||||
boundary.unwrap_or_else(|| [[0.], [1.]].map(Point::from));
|
inner: [[0.], [1.]].map(Point::from),
|
||||||
|
});
|
||||||
let path = SurfacePath::line_from_points_with_coords(
|
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);
|
let half_edge = HalfEdge::unjoined(core).insert(core);
|
||||||
@ -130,10 +131,7 @@ pub trait BuildHalfEdge {
|
|||||||
);
|
);
|
||||||
core.layers.geometry.define_half_edge(
|
core.layers.geometry.define_half_edge(
|
||||||
half_edge.clone(),
|
half_edge.clone(),
|
||||||
HalfEdgeGeom {
|
HalfEdgeGeom { path, boundary },
|
||||||
path,
|
|
||||||
boundary: boundary.into(),
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
half_edge
|
half_edge
|
||||||
|
@ -94,7 +94,7 @@ pub trait BuildShell {
|
|||||||
.map(|((vertex, positions), (curve, boundary))| {
|
.map(|((vertex, positions), (curve, boundary))| {
|
||||||
let half_edge = HalfEdge::line_segment(
|
let half_edge = HalfEdge::line_segment(
|
||||||
positions,
|
positions,
|
||||||
Some(boundary.reverse().inner),
|
Some(boundary.reverse()),
|
||||||
surface.clone(),
|
surface.clone(),
|
||||||
core,
|
core,
|
||||||
);
|
);
|
||||||
|
@ -2,6 +2,7 @@ use fj_interop::{ext::ArrayExt, Color};
|
|||||||
use fj_math::{Point, Scalar, Vector};
|
use fj_math::{Point, Scalar, Vector};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
geometry::CurveBoundary,
|
||||||
operations::{
|
operations::{
|
||||||
build::{BuildCycle, BuildHalfEdge},
|
build::{BuildCycle, BuildHalfEdge},
|
||||||
geometry::UpdateHalfEdgeGeometry,
|
geometry::UpdateHalfEdgeGeometry,
|
||||||
@ -121,7 +122,7 @@ impl SweepHalfEdge for Handle<HalfEdge> {
|
|||||||
let half_edge = {
|
let half_edge = {
|
||||||
let line_segment = HalfEdge::line_segment(
|
let line_segment = HalfEdge::line_segment(
|
||||||
[start, end],
|
[start, end],
|
||||||
Some(boundary),
|
Some(CurveBoundary { inner: boundary }),
|
||||||
surface.clone(),
|
surface.clone(),
|
||||||
core,
|
core,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user