Giter VIP home page Giter VIP logo

rotating_calipers's Introduction

Rotating calipers module

Rotating calipers is python module implementing an algorithm with the same name.

Rotating calipers algorithm

Algorithm was first invented by Michalel Shamos in 1978 and gained its name "rotating calipers" thanks to Godfried Toussant who featured it in his paper in 1983.

The method is so named because the idea is analogous to rotating a spring-loaded vernier caliper around the outside of a convex polygon. Every time one blade of the caliper lies flat against an edge of the polygon, it forms an antipodal pair with the point or edge touching the opposite blade. The complete "rotation" of the caliper around the polygon detects all antipodal pairs; the set of all pairs, viewed as a graph, forms a thrackle. The method of rotating calipers can be interpreted as the projective dual of a sweep line algorithm in which the sweep is across slopes of lines rather than across x- or y-coordinates of points.

Above description was adapted from wikipedia page: https://en.wikipedia.org/wiki/Rotating_calipers

Motivation

The "rotating calipers" algorithm was implemented by me for a university project. Suprisingly I went through a lot of trouble finding an efficient solution in python. That is why I wanted to share it with everyone who needs fast "rotating calipers" implementation in python.

Complexity

As rotating calipers runs in linear time it needs a convex hull on input wihch is calculated here using Graham's algorithm which runs in O(nlogn). All in all algorihm's (Graham's algorithm + rotating calipers) time complexity is O(nlogn) + O(n) = O(nlogn)

How to install

Linux:

  1. Open terminal
  2. Run: pip install rotating-calipers

How to use

Example of use can be found here

rotating_calipers's People

Contributors

jakubfr4czek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.