Skip to content

Commit

Permalink
Merge branch 'main' into segmentize
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahParry authored Aug 26, 2023
2 parents d05f1cd + d13e70c commit c960f68
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 143 deletions.
2 changes: 1 addition & 1 deletion geo-types/src/geometry/geometry_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ where
return false;
}

let mut mp_zipper = self.into_iter().zip(other.into_iter());
let mut mp_zipper = self.into_iter().zip(other);
mp_zipper.all(|(lhs, rhs)| lhs.abs_diff_eq(rhs, epsilon))
}
}
Expand Down
2 changes: 1 addition & 1 deletion geo-types/src/geometry/multi_line_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ where
return false;
}

let mut mp_zipper = self.into_iter().zip(other.into_iter());
let mut mp_zipper = self.into_iter().zip(other);
mp_zipper.all(|(lhs, rhs)| lhs.abs_diff_eq(rhs, epsilon))
}
}
Expand Down
2 changes: 1 addition & 1 deletion geo-types/src/geometry/multi_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ where
return false;
}

let mut mp_zipper = self.into_iter().zip(other.into_iter());
let mut mp_zipper = self.into_iter().zip(other);
mp_zipper.all(|(lhs, rhs)| lhs.abs_diff_eq(rhs, epsilon))
}
}
Expand Down
2 changes: 1 addition & 1 deletion geo-types/src/geometry/multi_polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ where
return false;
}

let mut mp_zipper = self.into_iter().zip(other.into_iter());
let mut mp_zipper = self.into_iter().zip(other);
mp_zipper.all(|(lhs, rhs)| lhs.abs_diff_eq(rhs, epsilon))
}
}
Expand Down
4 changes: 2 additions & 2 deletions geo/src/algorithm/monotone/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! This implementation is based on these awesome [lecture notes] by David
//! Mount. The broad idea is to run a left-right planar sweep on the segments
//! of the polygon and try to iteratively extend parallel monotone chains.
//! of the polygon and try to iteratively extend parallel monotone chains.
//!
//! [lecture notes]:
//! //www.cs.umd.edu/class/spring2020/cmsc754/Lects/lect05-triangulate.pdf
Expand Down Expand Up @@ -41,7 +41,7 @@ impl<T: GeoNum> Builder<T> {
let (ext, ints) = polygon.into_inner();
Some(ext)
.into_iter()
.chain(ints.into_iter())
.chain(ints)
.flat_map(|ls| -> Vec<_> { ls.lines().collect() })
.filter_map(|line| {
if line.start == line.end {
Expand Down
46 changes: 1 addition & 45 deletions geo/src/algorithm/sweep/active.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::{
borrow::Borrow,
cmp::Ordering,
collections::BTreeSet,
fmt::Debug,
ops::{Bound, Deref},
};
use std::{borrow::Borrow, cmp::Ordering, fmt::Debug, ops::Deref};

/// A segment currently active in the sweep.
///
Expand Down Expand Up @@ -86,41 +80,3 @@ pub(in crate::algorithm) trait ActiveSet: Default {
fn insert_active(&mut self, segment: Self::Seg);
fn remove_active(&mut self, segment: &Self::Seg);
}

impl<T: PartialOrd + Debug> ActiveSet for BTreeSet<Active<T>> {
type Seg = T;

fn previous_find<F: FnMut(&Active<Self::Seg>) -> bool>(
&self,
segment: &Self::Seg,
mut f: F,
) -> Option<&Active<Self::Seg>> {
self.range::<Active<_>, _>((
Bound::Unbounded,
Bound::Excluded(Active::active_ref(segment)),
))
.rev()
.find(|&a| f(a))
}
fn next_find<F: FnMut(&Active<Self::Seg>) -> bool>(
&self,
segment: &Self::Seg,
mut f: F,
) -> Option<&Active<Self::Seg>> {
self.range::<Active<_>, _>((
Bound::Excluded(Active::active_ref(segment)),
Bound::Unbounded,
))
.find(|&a| f(a))
}

fn insert_active(&mut self, segment: Self::Seg) {
let result = self.insert(Active(segment));
debug_assert!(result);
}

fn remove_active(&mut self, segment: &Self::Seg) {
let result = self.remove(Active::active_ref(segment));
debug_assert!(result);
}
}
Loading

0 comments on commit c960f68

Please sign in to comment.