/bbox2d

Solving several 2D bounding box problems using rotating calibers algorithm

Primary LanguageC++MIT LicenseMIT

bbox2d

C++ code that solves several 2D bounding box problems using the rotating calipers algorithm

  • bounding box with minimal area
  • bounding box with shortest perimeter
  • bounding box that fits into a given rectangle

Runs in O(n) for a polygon with n vertices

Examples

  • build
> mkdir build
> cd build
> cmake ..
> make

This creates bbox2d in build folder and libbbox2dlib.a in build/src folder

  • command: > bbox2d ../examples/dragon.poly

  • output:

notice the slight difference near the foot of the dragon.

Left: Minimum area bounding box Right: Minimum perimeter bounding box