Reintroduce improved logic for mesh interior region fill determination (#4464)

* Decide branching mesh fill insideness by winding, normalizing drawn direction at the Path node

* Fix dead connector click targets by explicitly closing the kurbo ellipse port paths

* Fix hole subtraction when a hole vertex is snapped exactly onto its covering contour

* Classify embedded negative space by its single surrounding face so fully enclosed mesh cells still fill
This commit is contained in:
Keavon Chambers
2026-08-19 00:59:40 -07:00
committed by GitHub
parent daa8b6a5a4
commit 2fa6b743fe
6 changed files with 652 additions and 61 deletions

View File

@@ -1435,9 +1435,11 @@ pub(crate) fn replace_with_polygons(vector: &mut Vector, polygons: Vec<Vec<DVec2
if start == end {
continue;
}
// Emit shared walls in index-canonical direction: a cycle can't be monotone in point index,
// so no cell's boundary can wind coherently and read as deliberate negative space
let edge = if start < end { (start, end) } else { (end, start) };
if seen_edges.insert(edge) {
segment_domain.push(next_segment.next_id(), start, end, BezierHandles::Linear);
segment_domain.push(next_segment.next_id(), edge.0, edge.1, BezierHandles::Linear);
}
}
}
@@ -3543,10 +3545,11 @@ fn element_centroid(element: &Vector, transform: DAffine2, centroid_type: Centro
mod test {
use super::*;
use core_types::Node;
use kurbo::{CubicBez, Ellipse, Point, Rect};
use kurbo::{CubicBez, Point, Rect};
use std::future::Future;
use std::pin::Pin;
use vector_types::vector::algorithms::bezpath_algorithms::{TValue, trim_pathseg};
use vector_types::vector::algorithms::shapes::ellipse_bezpath;
use vector_types::vector::misc::pathseg_abs_diff_eq;
#[derive(Clone)]
@@ -3842,7 +3845,7 @@ mod test {
async fn poisson() {
let poisson_points = super::scatter_points(
Footprint::default(),
vector_item_from_bezpath(Ellipse::from_rect(Rect::new(-50., -50., 50., 50.)).to_path(DEFAULT_ACCURACY)),
vector_item_from_bezpath(ellipse_bezpath(DVec2::splat(-50.), DVec2::splat(50.))),
Item::new_from_element(10. * std::f64::consts::SQRT_2),
Item::new_from_element(0),
)