Skip to content

Commit

Permalink
Upstream rebase (#3) (#6)
Browse files Browse the repository at this point in the history
* chore: add spade as a dependency

although spade is a optional dependency, it looks like a good fit for
the default features. Including it has the effect of bringing in 3 new
dependencies:

- robust 0.2 (we already use this)
- optional 0.5
- spade 2.2

I'll try to speak to the spade maintainers. Maybe we can bump the robust
version in their crate to reduce dependencies further. Also it might
make sense to ask them if the optional crate provides any real value.

* feat: initial implementation of TriangulateSpade trait

* fix: ignore example pictures in doc tests

* chore: add changelog entry

* chore: fix comment

* chore: apply review suggestion for doc comments

* chore: capitalize Delaunay

* chore: fix typo: convertes -> converts

* chore: fix typo: achives -> achieves

* feat: put required methods into a sealed trait so we don't leak them

* feat: add tests for the shapes in the doc comments

* chore: add doc tests and move cleanup function to sealed trait

* chore: fix typo

* chore: apply review suggestion for naming

* chore: improve description, worsen english

* chore: fix weird line wrap

* fix: pass epsilon as parameter + rename points -> coords

* chore: add test for different snap radius values

* chore: add link that explains constrained Delaunay triangulations

* Add len to MultiPoint.

* Add is_empty to MultiPoint.

* Add entry to geo/CHANGES.md for len and is_empty on MultiPoint.

* prepare for geo-types 0.7.12 release

* Prepare for 0.27.0 release

* Update Cargo.toml

* geo now requires at least geo-types 0.7.12 for the wkt macro and the
`use-rstar_0_11` feature flag.

* Add voronoi (#2)

* Add Delaunay triangulation

Signed-off-by: Ben Johnston <[email protected]>

* feat: Delaunay documentation

Signed-off-by: Ben Johnston <[email protected]>

* feat: Add Voronoi diagram

Signed-off-by: Ben Johnston <[email protected]>

* feat: Voronoi testing

Signed-off-by: Ben Johnston <[email protected]>

* feat: Remove ndarray crates

* chore: Remove unwanted Result

* feat: Remove Circle struct

* feat: Remove nested loop

* feat: Add test to trim intersection to None

* chore: Update CHANGES.md

* feat: Address review comments

---------

Signed-off-by: Ben Johnston <[email protected]>

* Upstream rebase (#3)

* chore: add spade as a dependency

although spade is a optional dependency, it looks like a good fit for
the default features. Including it has the effect of bringing in 3 new
dependencies:

- robust 0.2 (we already use this)
- optional 0.5
- spade 2.2

I'll try to speak to the spade maintainers. Maybe we can bump the robust
version in their crate to reduce dependencies further. Also it might
make sense to ask them if the optional crate provides any real value.

* feat: initial implementation of TriangulateSpade trait

* fix: ignore example pictures in doc tests

* chore: add changelog entry

* chore: fix comment

* chore: apply review suggestion for doc comments

* chore: capitalize Delaunay

* chore: fix typo: convertes -> converts

* chore: fix typo: achives -> achieves

* feat: put required methods into a sealed trait so we don't leak them

* feat: add tests for the shapes in the doc comments

* chore: add doc tests and move cleanup function to sealed trait

* chore: fix typo

* chore: apply review suggestion for naming

* chore: improve description, worsen english

* chore: fix weird line wrap

* fix: pass epsilon as parameter + rename points -> coords

* chore: add test for different snap radius values

* chore: add link that explains constrained Delaunay triangulations

* Add voronoi (#2)

* Add Delaunay triangulation

Signed-off-by: Ben Johnston <[email protected]>

* feat: Delaunay documentation

Signed-off-by: Ben Johnston <[email protected]>

* feat: Add Voronoi diagram

Signed-off-by: Ben Johnston <[email protected]>

* feat: Voronoi testing

Signed-off-by: Ben Johnston <[email protected]>

* feat: Remove ndarray crates

* chore: Remove unwanted Result

* feat: Remove Circle struct

* feat: Remove nested loop

* feat: Add test to trim intersection to None

* chore: Update CHANGES.md

* feat: Address review comments

---------

Signed-off-by: Ben Johnston <[email protected]>

---------

Signed-off-by: Ben Johnston <[email protected]>
Co-authored-by: aviac <[email protected]>
Co-authored-by: RobWalt <[email protected]>
Co-authored-by: Stephan Hügel <[email protected]>

---------

Signed-off-by: Ben Johnston <[email protected]>
Co-authored-by: aviac <[email protected]>
Co-authored-by: RobWalt <[email protected]>
Co-authored-by: Stephan Hügel <[email protected]>
Co-authored-by: andriyDev <[email protected]>
Co-authored-by: Michael Kirk <[email protected]>
Co-authored-by: Corey Farwell <[email protected]>
  • Loading branch information
7 people committed Jan 24, 2024
1 parent d867c9c commit 1efbbc4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion geo-types/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changes

## Unrealeased
## 0.7.12

* Add `Polygon::try_exterior_mut` and `Polygon::try_interiors_mut`.
<https://github.com/georust/geo/pull/1071>
Expand Down
2 changes: 1 addition & 1 deletion geo-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "geo-types"
version = "0.7.11"
version = "0.7.12"
license = "MIT OR Apache-2.0"
repository = "https://github.com/georust/geo"
documentation = "https://docs.rs/geo-types/"
Expand Down
16 changes: 12 additions & 4 deletions geo-types/src/geometry/multi_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ use core::iter::FromIterator;
pub struct MultiPoint<T: CoordNum = f64>(pub Vec<Point<T>>);

impl<T: CoordNum, IP: Into<Point<T>>> From<IP> for MultiPoint<T> {
/// Convert a single `Point` (or something which can be converted to a `Point`) into a
/// one-member `MultiPoint`
/// Convert a single `Point` (or something which can be converted to a
/// `Point`) into a one-member `MultiPoint`
fn from(x: IP) -> Self {
Self(vec![x.into()])
}
}

impl<T: CoordNum, IP: Into<Point<T>>> From<Vec<IP>> for MultiPoint<T> {
/// Convert a `Vec` of `Points` (or `Vec` of things which can be converted to a `Point`) into a
/// `MultiPoint`.
/// Convert a `Vec` of `Points` (or `Vec` of things which can be converted
/// to a `Point`) into a `MultiPoint`.
fn from(v: Vec<IP>) -> Self {
Self(v.into_iter().map(|p| p.into()).collect())
}
Expand Down Expand Up @@ -90,6 +90,14 @@ impl<T: CoordNum> MultiPoint<T> {
Self(value)
}

pub fn len(&self) -> usize {
self.0.len()
}

pub fn is_empty(&self) -> bool {
self.0.is_empty()
}

pub fn iter(&self) -> impl Iterator<Item = &Point<T>> {
self.0.iter()
}
Expand Down
7 changes: 6 additions & 1 deletion geo/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changes

## Unreleased
## 0.27.0

* Use `CachedEnvelope` in R-Trees when computing euclidean distance between polygons
* <https://github.com/georust/geo/pull/1093>
Expand All @@ -27,6 +27,11 @@
* Fix coordinate wrapping in `HaversineDestination`
* <https://github.com/georust/geo/pull/1091>
* Add `wkt!` macro to define geometries at compile time.
* <https://github.com/georust/geo/pull/1063>
* Add `TriangulateSpade` trait which provides (un)constrained Delaunay Triangulations for all `geo_types` via the `spade` crate
* <https://github.com/georust/geo/pull/1083>
* Add `len()` and `is_empty()` to `MultiPoint`
* <https://github.com/georust/geo/pull/1109>
<https://github.com/georust/geo/pull/1063>
* Add `TriangulateSpade` trait which provides (un)constrained Delaunay Triangulations for all `geo_types` via the `spade` crate
* <https://github.com/georust/geo/pull/1083>
Expand Down
8 changes: 4 additions & 4 deletions geo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "geo"
description = "Geospatial primitives and algorithms"
version = "0.26.0"
version = "0.27.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/georust/geo"
documentation = "https://docs.rs/geo/"
Expand All @@ -13,18 +13,18 @@ rust-version = "1.65"
categories = ["science::geo"]

[features]
default = ["earcutr", "spade", "delaunay", "voronoi"]
delaunay = []
default = ["earcutr", "spade", "voronoi"]
proj-network = ["use-proj", "proj/network"]
use-proj = ["proj"]
use-serde = ["serde", "geo-types/serde"]
delaunay = []
voronoi = ["delaunay"]

[dependencies]
earcutr = { version = "0.4.2", optional = true }
spade = { version = "2.2.0", optional = true }
float_next_after = "1.0.0"
geo-types = { version = "0.7.9", features = ["approx", "use-rstar_0_11"] }
geo-types = { version = "0.7.12", features = ["approx", "use-rstar_0_11"] }
geographiclib-rs = { version = "0.2.3", default-features = false }
log = "0.4.11"
num-traits = "0.2"
Expand Down

0 comments on commit 1efbbc4

Please sign in to comment.