Skip to content

[FEATURE REQUEST] Adding RotatingCalipers to geometry #6672

@yadhu-vipin

Description

@yadhu-vipin

What would you like to Propose?

Proposal

I would like to add the Rotating Calipers algorithm under the geometry package.
This algorithm provides geometric computations for convex polygons, including:
Diameter – the largest distance between any two points of a convex polygon.
Width – the smallest distance between two parallel lines enclosing the polygon.
Minimum-area bounding rectangle – the rectangle with minimal area that encloses all points.

Purpose

Adding this algorithm will:
Enhance the geometry package with a fundamental computational geometry algorithm.
Help learners understand geometric properties of convex polygons.
Maintain consistency with the repository’s focus on educational, well-documented algorithms.
Implementation
Fully static and final class.
Proper JavaDoc documentation for each method.
Unit tests using JUnit 5 covering simple and complex cases.
Follows the project’s CheckStyle and conventions.

Reference

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, compute the diameter, width, and minimum-area bounding rectangle efficiently using the rotating calipers technique.

Algorithm Description:

Compute the convex hull of the given points.
Apply rotating calipers to compute the desired geometric property.
Return results with proper data structures (PointPair, Rectangle).

Benefits

Educational: allows learners to explore convex polygon properties.
Extends the repository with a well-documented, unit-tested geometric algorithm.

Implementation Details

Class is static and final.

Full JavaDoc documentation included.

Unit tests written with JUnit 5.

Adheres to project CheckStyle rules.

Additional Information

This PR is intended for Hacktoberfest.

The changes are isolated to the geometry package; unrelated CI errors (if any) are not caused by these files.

Issue details

This PR adds the Rotating Calipers algorithm and its tests. The CI may show unrelated test failures (e.g., BloomFilterTest), but my changes are isolated to the geometry package and pass all their own tests

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions