feat: added ContinuousZoomEuclideanCentroidAlgorithm #1559
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the
ContinuousZoomEuclideanCentroidAlgorithm
, a new clustering algorithm to fix some issues present in theNonHierarchicalDistanceBasedAlgorithm
(namely, aggresivevity while clustering). It avoids the limitations ofNonHierarchicalDistanceBasedAlgorithm
, like abrupt clustering changes when zoom crosses integer levels and the square-based proximity check.The algorithm works with continuous zoom, computing the clustering radius using the fractional zoom level, so the threshold changes smoothly as you zoom in or out. This makes clustering more natural and visually consistent.
It also uses Euclidean distance to decide cluster membership. The quadtree search still uses a square for performance, but items are only added to a cluster if they fall within a circular radius, avoiding the diagonal over-merging problem.
This comes as a separate algorithm instead of changing
NonHierarchicalDistanceBasedAlgorithm
, so we don’t introduce any behavior changes for existing users.