Skip to content

Commit

Permalink
Add all remaining predicates
Browse files Browse the repository at this point in the history
covered by, covers, crosses, overlaps, touches
  • Loading branch information
urschrei committed Jan 21, 2024
1 parent a318130 commit 46054aa
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 30 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The `geo` crate provides geospatial primitive types such as `Point`, `LineString
- Simplification and convex hull operations
- Euclidean and Haversine distance measurement
- Intersection checks
- Affine transforms such as rotation and translation.
- Affine transforms such as rotation and translation
- All DE-9IM spatial predicates such as contains, crosses, and touches.

Please refer to [the documentation](https://docs.rs/geo) for a complete list.

Expand Down
2 changes: 1 addition & 1 deletion geo-types/src/wkt_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Creates a [`crate::geometry`] from a
/// [WKT](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) literal.
///
/// This is evaluated at compile time, so you don't need to worry about runtime errors from inavlid
/// This is evaluated at compile time, so you don't need to worry about runtime errors from invalid
/// WKT syntax.
///
/// Note that `POINT EMPTY` is not accepted because it is not representable as a `geo_types::Point`.
Expand Down
4 changes: 3 additions & 1 deletion geo/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* <https://github.com/georust/geo/pull/1133>
* Add docs to Relate trait
* <https://github.com/georust/geo/pull/1135>
* Add remaining Relate predicates
* <https://github.com/georust/geo/pull/1136>

## 0.27.0

Expand Down Expand Up @@ -79,7 +81,7 @@

- Add `TriangulateEarcut` algorithm trait to triangulate polygons with the earcut algorithm.
- <https://github.com/georust/geo/pull/1007>
- Add `Vector2DOps` trait to algorithims module and implemented it for `Coord<T::CoordFloat>`
- Add `Vector2DOps` trait to algorithms module and implemented it for `Coord<T::CoordFloat>`
- <https://github.com/georust/geo/pull/1025>

- Add a fast point-in-polygon query datastructure that pre-processes a `Polygon` as a set of monotone polygons. Ref. `crate::algorithm::MonotonicPolygons`.
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/haversine_closest_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use num_traits::FromPrimitive;
/// * Longitude (x) in the [-180; 180] degrees range.
/// * Latitude (y) in the [-90; 90] degrees range.
///
/// The implemetation is based on <https://edwilliams.org/avform147.htm#XTE>.
/// The implementation is based on <https://edwilliams.org/avform147.htm#XTE>.
///
/// See [`Closest<F>`] for a description of the return states.
///
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/monotone/mono_poly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<T: GeoNum> std::fmt::Debug for MonoPoly<T> {
impl<T: GeoNum> MonoPoly<T> {
/// Create a monotone polygon from the top and bottom chains.
///
/// Note: each chain must be a strictly increasing sequence (in the lexigraphic
/// Note: each chain must be a strictly increasing sequence (in the lexicographic
/// order), with the same start and end points. Further, the top chain must be
/// strictly above the bottom chain except at the end-points. Not all these
/// conditions are checked, and the algorithm may panic if they are not met.
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/monotone/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<T: GeoNum, P> From<Segment<T, P>> for RcSegment<T, P> {
}
}

// Implement partial eq, parital ord, and eq for RcSegment
// Implement partial eq, partial ord, and eq for RcSegment
impl<T: GeoNum, P> PartialEq for RcSegment<T, P> {
fn eq(&self, other: &Self) -> bool {
self.0.eq(&other.0)
Expand Down
303 changes: 284 additions & 19 deletions geo/src/algorithm/relate/geomgraph/intersection_matrix.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion geo/src/algorithm/relate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod relate_operation;

/// Topologically relate two geometries based on [DE-9IM](https://en.wikipedia.org/wiki/DE-9IM) semantics.
///
/// See [`IntersectionMatrix`] for details.
/// See [`IntersectionMatrix`] for details. All predicates are available on the calculated matrix.
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/sweep/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<C> CrossingsIter<C>
where
C: Cross + Clone,
{
/// Faster sweep when input goemetries are known to not intersect except at
/// Faster sweep when input geometries are known to not intersect except at
/// end-points.
pub fn new_simple<I: IntoIterator<Item = C>>(iter: I) -> Self {
Self::new_ex(iter, true)
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/sweep/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<T: GeoNum> Deref for SweepPoint<T> {
}
}

// Note: We keep it immutable for now, for better hygeine.
// Note: We keep it immutable for now, for better hygiene.
// impl<T: GeoNum> DerefMut for SweepPoint<T> {
// fn deref_mut(&mut self) -> &mut Self::Target {
// &mut self.0
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/triangulate_earcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub trait TriangulateEarcut<T: CoordFloat> {
}

/// Return the raw result from the `earcutr` library: a one-dimensional vector of polygon
/// vertices (in XY order), and the indicies of the triangles within the vertices vector. This
/// vertices (in XY order), and the indices of the triangles within the vertices vector. This
/// method is less ergonomic than the `earcut_triangles` and `earcut_triangles_iter`
/// methods, but can be helpful when working in graphics contexts that expect flat vectors of
/// data.
Expand Down
2 changes: 1 addition & 1 deletion rfcs/2022-05-24-boolean-ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ captured in the `BoolOp` struct that implements the above trait.
We also support clipping of a 1D geometry by a 2D geometry. This is the
same as intersection but between geometries of different dimensions. In
this case, we calculate region solely from the 2D geometry, and only output
segments from the 1D geomtries. These are then assembled to output a
segments from the 1D geometries. These are then assembled to output a
`MultiLineString` in this case. This is captured in the `ClipOp` struct.

Pls. ref `geo/src/algorithm/bool_ops/spec.rs`.
Expand Down

0 comments on commit 46054aa

Please sign in to comment.