From cc6e8dcf2b9b784957d5c95eae8dbcffcdad98da Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 20 Feb 2024 14:59:50 -0800 Subject: [PATCH 1/2] attempt to better document Simplify traits `epsilon` parameter --- geo/src/algorithm/simplify.rs | 14 ++++++++++++-- geo/src/algorithm/simplify_vw.rs | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/geo/src/algorithm/simplify.rs b/geo/src/algorithm/simplify.rs index 1151c7698..822daf5ef 100644 --- a/geo/src/algorithm/simplify.rs +++ b/geo/src/algorithm/simplify.rs @@ -153,7 +153,12 @@ where /// /// Multi* objects are simplified by simplifying all their constituent geometries individually. /// -/// An epsilon less than or equal to zero will return an unaltered version of the geometry. +/// A larger `epsilon` means being more aggressive about removing points with less concern for +/// maintaining the existing shape. Specifically, when you consider whether to remove a point, you +/// can draw a triangle consisting of the candidate point and the points before and after it. +/// If the area of this triangle is less than `epsilon`, we will remove the point. +/// +/// An `epsilon` less than or equal to zero will return an unaltered version of the geometry. pub trait Simplify { /// Returns the simplified representation of a geometry, using the [Ramer–Douglas–Peucker](https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm) algorithm /// @@ -192,7 +197,12 @@ pub trait Simplify { /// This operation uses the [Ramer–Douglas–Peucker algorithm](https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm) /// and does not guarantee that the returned geometry is valid. /// -/// An epsilon less than or equal to zero will return an unaltered version of the geometry. +/// A larger `epsilon` means being more aggressive about removing points with less concern for +/// maintaining the existing shape. Specifically, when you consider whether to remove a point, you +/// can draw a triangle consisting of the candidate point and the points before and after it. +/// If the area of this triangle is less than `epsilon`, we will remove the point. +/// +/// An `epsilon` less than or equal to zero will return an unaltered version of the geometry. pub trait SimplifyIdx { /// Returns the simplified indices of a geometry, using the [Ramer–Douglas–Peucker](https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm) algorithm /// diff --git a/geo/src/algorithm/simplify_vw.rs b/geo/src/algorithm/simplify_vw.rs index 47e5c2971..ec5ed9627 100644 --- a/geo/src/algorithm/simplify_vw.rs +++ b/geo/src/algorithm/simplify_vw.rs @@ -479,7 +479,12 @@ pub trait SimplifyVw { /// This operation uses the Visvalingam-Whyatt algorithm, /// and does **not** guarantee that the returned geometry is valid. /// -/// An epsilon less than or equal to zero will return an unaltered version of the geometry. +/// A larger `epsilon` means being more aggressive about removing points with less concern for +/// maintaining the existing shape. Specifically, when you consider whether to remove a point, you +/// can draw a triangle consisting of the candidate point and the points before and after it. +/// If the area of this triangle is less than `epsilon`, we will remove the point. +/// +/// An `epsilon` less than or equal to zero will return an unaltered version of the geometry. pub trait SimplifyVwIdx { /// Returns the simplified representation of a geometry, using the [Visvalingam-Whyatt](http://www.tandfonline.com/doi/abs/10.1179/000870493786962263) algorithm /// @@ -516,7 +521,12 @@ pub trait SimplifyVwIdx { /// Simplifies a geometry, attempting to preserve its topology by removing self-intersections /// -/// An epsilon less than or equal to zero will return an unaltered version of the geometry +/// A larger `epsilon` means being more aggressive about removing points with less concern for +/// maintaining the existing shape. Specifically, when you consider whether to remove a point, you +/// can draw a triangle consisting of the candidate point and the points before and after it. +/// If the area of this triangle is less than `epsilon`, we will remove the point. +/// +/// An `epsilon` less than or equal to zero will return an unaltered version of the geometry. pub trait SimplifyVwPreserve { /// Returns the simplified representation of a geometry, using a topology-preserving variant of the /// [Visvalingam-Whyatt](http://www.tandfonline.com/doi/abs/10.1179/000870493786962263) algorithm. From 186e9a74b4cd01ba7e68d919e11771a8847ff196 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 20 Feb 2024 15:28:18 -0800 Subject: [PATCH 2/2] fixup! attempt to better document Simplify traits `epsilon` parameter --- geo/src/algorithm/simplify.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/geo/src/algorithm/simplify.rs b/geo/src/algorithm/simplify.rs index 822daf5ef..c5cdb07da 100644 --- a/geo/src/algorithm/simplify.rs +++ b/geo/src/algorithm/simplify.rs @@ -154,9 +154,10 @@ where /// Multi* objects are simplified by simplifying all their constituent geometries individually. /// /// A larger `epsilon` means being more aggressive about removing points with less concern for -/// maintaining the existing shape. Specifically, when you consider whether to remove a point, you -/// can draw a triangle consisting of the candidate point and the points before and after it. -/// If the area of this triangle is less than `epsilon`, we will remove the point. +/// maintaining the existing shape. +/// +/// Specifically, points closer than `epsilon` distance from the simplified output may be +/// discarded. /// /// An `epsilon` less than or equal to zero will return an unaltered version of the geometry. pub trait Simplify { @@ -198,9 +199,10 @@ pub trait Simplify { /// and does not guarantee that the returned geometry is valid. /// /// A larger `epsilon` means being more aggressive about removing points with less concern for -/// maintaining the existing shape. Specifically, when you consider whether to remove a point, you -/// can draw a triangle consisting of the candidate point and the points before and after it. -/// If the area of this triangle is less than `epsilon`, we will remove the point. +/// maintaining the existing shape. +/// +/// Specifically, points closer than `epsilon` distance from the simplified output may be +/// discarded. /// /// An `epsilon` less than or equal to zero will return an unaltered version of the geometry. pub trait SimplifyIdx {