Rotating calipers

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
File:Rotating Caliper 3x2.svg
Sequence of probes around the convex hull of a polygon to determine its diameter using Rotating Caliper method.

In computational geometry, the method of rotating calipers is an algorithm design technique that can be used to solve optimization problems including finding the width or diameter of a set of points.

The method is so named because the idea is analogous to rotating a spring-loaded vernier caliper around the outside of a convex polygon.[1] 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.

History

[edit | edit source]
File:Rotating Caliper Antipodal Pair.svg
An antipodal pair of vertex and their supporting parallel lines.

The rotating calipers method was first used in the dissertation of Michael Shamos in 1978.[2] Shamos used this method to generate all antipodal pairs of points on a convex polygon and to compute the diameter of a convex polygon in O(n) time. Godfried Toussaint coined the phrase "rotating calipers" and demonstrated that the method was applicable in solving many other computational geometry problems.[3]

File:Rotating calipers, finding a bridge between two convex polygons.svg
Rotating calipers, finding a bridge between two convex polygons

Shamos's algorithm

[edit | edit source]

Shamos gave the following algorithm in his dissertation (pp. 77–82) for the rotating calipers method, which generated all antipodal pairs of vertices on a convex polygon:[2]

/* p[] is in standard form, ie, counter clockwise order, 
     distinct vertices, no collinear vertices.
   ANGLE(m, n) is a procedure that returns the clockwise angle 
     swept out by a ray as it rotates from a position parallel 
     to the directed segment Pm,Pm+1 to a position parallel to Pn, Pn+1
   We assume all indices are reduced to mod N (so that N+1 = 1).
*/
GetAllAntiPodalPairs(p[1..n])
    // Find first anti-podal pair by locating vertex opposite P1
    i = 1
    j = 2
    while angle(i, j) < pi
        j++
    yield i, j

    /* Now proceed around the polygon taking account of
         possibly parallel edges. Line L passes through
         Pi, Pi+1 and M passes through Pj, Pj+1
    */

    // Loop on j until all of P has been scanned
    current = i    
    while j != n
        if angle(current, i + 1) <= angle(current, j + 1)
            j++
            current = j
        else
            i++
            current = i
        yield i, j

        // Now take care of parallel edges
        if angle(current, i + 1) = angle(current, j + 1)
            yield i + 1, j
            yield i, j + 1
            yield i + 1, j + 1
            if current = i
                j++
            else
                i++

Another version of this algorithm appeared in the text by Preparata and Shamos in 1985 that avoided calculation of angles:[4]

GetAllAntiPodalPairs(p[1..n])
    i = n
    j = i + 1
    while (Area(i, i + 1, j + 1) > Area(i, i + 1, j))
        j = j + 1
    j0 = j
    while (i != j0)
        i = i + 1
        yield i, j
        while (Area(i, i + 1, j + 1) > Area(i, i + 1, j))
            j = j + 1
            if ((i, j) != (j0, 1))
                yield i, j
        if (Area(i, i + 1, j + 1) = Area(i, i + 1, j))
            if ((i, j) != (j0, n))
                yield i, j + 1

Applications

[edit | edit source]

Pirzadeh[5] describes various applications of rotating calipers method.

Distances

[edit | edit source]
  • Diameter (maximum width) of a convex polygon[6][7]
  • Width (minimum width) of a convex polygon[8]
  • Maximum distance between two convex polygons[9][10]
  • Minimum distance between two convex polygons[11][12]
  • Widest empty (or separating) strip between two convex polygons (a simplified low-dimensional variant of a problem arising in support vector machine based machine learning)
  • Grenander distance between two convex polygons[13]
  • Optimal strip separation (used in medical imaging and solid modeling)[14]

Bounding boxes

[edit | edit source]

Triangulations

[edit | edit source]

Multi-polygon operations

[edit | edit source]
  • Union of two convex polygons
  • Common tangents to two convex polygons
  • Intersection of two convex polygons[16]
  • Critical support lines of two convex polygons
  • Vector sums (or Minkowski sum) of two convex polygons[17]
  • Convex hull of two convex polygons

Traversals

[edit | edit source]
  • Shortest transversals[18][19]
  • Thinnest-strip transversals[20]

Others

[edit | edit source]
  • Non parametric decision rules for machine learned classification[21]
  • Aperture angle optimizations for visibility problems in computer vision[22]
  • Finding longest cells in millions of biological cells[23]
  • Comparing precision of two people at firing range
  • Classify sections of brain from scan images

See also

[edit | edit source]

References

[edit | edit source]
  1. ^ "Rotating Calipers" at Toussaint's home page
  2. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ Binay K. Bhattacharya and Godfried T. Toussaint, "Fast algorithms for computing the diameter of a finite planar set," The Visual Computer, Vol. 3, No. 6, May 1988, pp.379–388.
  7. ^ Binay K. Bhattacharya and Godfried T. Toussaint, "A counter example to a diameter algorithm for convex polygons," IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. PAMI-4, No. 3, May 1982, pp. 306–309.
  8. ^ Michael E. Houle and Godfried T. Toussaint, "Computing the width of a set," IEEE Transactions on Pattern Analysis & Machine Intelligence, Vol. 10, no. 5, September 1988, pp. 761–765.
  9. ^ Godfried T. Toussaint and Jim A. McAlear, "A simple O(n log n) algorithm for finding the maximum distance between two finite planar sets," Pattern Recognition Letters, Vol. 1, 1982, pp. 21–24.
  10. ^ Binay K. Bhattacharya and Godfried T. Toussaint, "Efficient algorithms for computing the maximum distance between two finite planar sets," Journal of Algorithms, vol. 14, 1983, pp. 121–136.
  11. ^ Godfried T. Toussaint and Binay K. Bhattacharya, "Optimal algorithms for computing the minimum distance between two finite planar sets," Pattern Recognition Letters, vol. 2, December, 1983, pp. 79–82.
  12. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  13. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  14. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  15. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  16. ^ Godfried T. Toussaint, "A simple linear algorithm for intersecting convex polygons, The Visual Computer, Vol. 1, 1985, pp. 118–123.
  17. ^ Tomas Lozano-Perez, "Spatial planning: A configuration space approach," IEEE Transactions on Computers, Vol. 32, No. 2, 1983, pp. 108–120.
  18. ^ Binay K. Bhattacharya and Godfried T. Toussaint, "Computing shortest transversals," Computing, vol. 46, 1991, pp. 93–119.
  19. ^ Binay K. Bhattacharya, Jurek Czyzowicz, Peter Egyed, Ivan Stojmenovic, Godfried T. Toussaint, and Jorje Urrutia, "Computing shortest transversals of sets," International Journal of Computational Geometry and Applications, Vol. 2, No. 4, December 1992, pp. 417–436.
  20. ^ Jean-Marc Robert and Godfried T. Toussaint, "Linear approximation of simple objects," Computational Geometry: Theory and Applications, Vol. 4, 1994, pp. 27–52.
  21. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  22. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  23. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).