mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-12 10:15:51 +00:00
Add CurveBoundary::contains
This commit is contained in:
parent
952c2ff845
commit
332992015f
@ -79,10 +79,8 @@ impl CurveApproxSegment {
|
||||
);
|
||||
|
||||
self.boundary = self.boundary.subset(boundary);
|
||||
|
||||
let [min, max] = self.boundary.inner;
|
||||
self.points
|
||||
.retain(|point| point.local_form > min && point.local_form < max);
|
||||
.retain(|point| self.boundary.contains(point.local_form));
|
||||
}
|
||||
|
||||
/// Merge the provided segment into this one
|
||||
@ -112,7 +110,7 @@ impl CurveApproxSegment {
|
||||
self.points.retain(|point| {
|
||||
// Only retain points that don't overlap with the other segment, or
|
||||
// we might end up with duplicates.
|
||||
point.local_form < other_min || point.local_form > other_max
|
||||
!other.boundary.contains(point.local_form)
|
||||
});
|
||||
self.points.extend(&other.points);
|
||||
self.points.sort();
|
||||
|
@ -65,6 +65,12 @@ impl CurveBoundary<Point<1>> {
|
||||
min >= max
|
||||
}
|
||||
|
||||
/// Indicate whether the boundary contains the given element
|
||||
pub fn contains(&self, point: Point<1>) -> bool {
|
||||
let [min, max] = self.inner;
|
||||
point > min && point < max
|
||||
}
|
||||
|
||||
/// Indicate whether the boundary overlaps another
|
||||
///
|
||||
/// Boundaries that touch (i.e. their closest boundary elements are equal)
|
||||
|
Loading…
Reference in New Issue
Block a user