You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: Add Rotating Calipers Algorithm to Geometry Package
Overview
This proposal suggests adding the Rotating Calipers algorithm to the geometry package. The Rotating Calipers technique enables efficient geometric computations for convex polygons, specifically:
Diameter (largest distance between any two points of a convex polygon)
Width (smallest distance between two parallel lines enclosing the polygon)
Minimum-area bounding rectangle (rectangle of minimal area enclosing all points)
Purpose
Integrating Rotating Calipers will:
Enhance the geometry module with essential computational geometry algorithms.
Foster educational exploration of convex polygon properties.
Align with repository goals for well-documented, quality algorithms.
Implementation
A single, fully static and final class: RotatingCalipers.
All methods have complete JavaDoc documentation.
Comprehensive JUnit 5 unit tests covering both simple and complex cases.
Follows repository CheckStyle, formatting, and naming conventions (static/final, clear method names, etc.).
References
Shamos, M.I. (1978). Computational Geometry.
Wikipedia: Rotating Calipers.
Issue Details
Algorithm Name: Rotating Calipers
Problem Statement:
Given a set of points representing a convex polygon, efficiently compute its diameter, width, and minimum-area bounding rectangle using the rotating calipers technique.
Algorithm Description:
Compute the convex hull of the input points.
Apply rotating calipers to find the geometric property (diameter, width, rectangle).
Return results in proper data structures (e.g., PointPair, Rectangle).
Benefits
Educational: Learners can explore fundamental convex polygon properties interactively.
Repository Extension: Adds a robust, unit-tested geometric algorithm, maintaining educational and quality standards.
Implementation Details
All methods are static and class is final.
Full JavaDoc coverage.
All new code meets project CheckStyle, naming, and formatting rules.
All new tests use JUnit 5.
The PR changes only geometry package files; any unrelated CI failures (e.g., in BloomFilterTest) are not a result of this submission.
The Rotating Calipers algorithm is a computational geometry technique used to efficiently compute various properties of convex polygons. This implementation provides methods to calculate:
6
+
7
+
-**Diameter**: The largest distance between any two points of a convex polygon
8
+
-**Width**: The smallest distance between two parallel lines enclosing the polygon
9
+
-**Minimum-area bounding rectangle**: The rectangle with minimal area that encloses all points
10
+
11
+
## Time Complexity
12
+
13
+
O(n) where n is the number of vertices in the convex polygon
0 commit comments