Skip to content

Conversation

motalib6
Copy link

@motalib6 motalib6 commented Oct 6, 2025

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.

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

alxkm and others added 2 commits October 5, 2025 18:28
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.
@motalib6
Copy link
Author

motalib6 commented Oct 6, 2025

Thank you for confirming. The previous proposal is now fully prepared and ready for use in your pull request or contribution documentation. This formal structure ensures all aspects—educational purpose, algorithm functionality, implementation standards, and references—are clearly communicated and meet the requirements for collaborative or open-source repositories, including Hacktoberfest submissions.

@motalib6 motalib6 force-pushed the rotating-calipers-algorithm branch from 760ed63 to a2ada7c Compare October 6, 2025 07:50
@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 97.82609% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.87%. Comparing base (c545617) to head (2251af2).

Files with missing lines Patch % Lines
...a/com/thealgorithms/geometry/RotatingCalipers.java 97.82% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##             update-directory    #6674      +/-   ##
======================================================
+ Coverage               75.75%   75.87%   +0.11%     
- Complexity               5773     5793      +20     
======================================================
  Files                     703      704       +1     
  Lines                   19777    19869      +92     
  Branches                 3832     3844      +12     
======================================================
+ Hits                    14983    15075      +92     
  Misses                   4215     4215              
  Partials                  579      579              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DenizAltunkapan DenizAltunkapan force-pushed the update-directory branch 11 times, most recently from 1db39c7 to c63ffff Compare October 8, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants