DIPlib Documentation - ©1995-2013 Quantitative Imaging Group, Delft University of Technology.

# ConvexHullGetFeret

Convex hull measurement function

## SYNOPSIS

`#include "dip_chaincode.h"`

dip_Error dip_ConvexHullGetFeret ( polygon, feret )

## FUNCTION

This function measures the longest and shortest projections of the object encoded by `polygon`. A "rotating calipers" algorithm finds all antipodal edges and vertices. Then the distances between each of these pairs is computed. These distances correspond to the lengths of the projection under an orientation perpendicular to the edge used. The maximum and minimum distance, as well as the corresponding orientations, are returned in the `feret` structure, which contains the following elements:

Data type | Name | Description
`dip_float` | `maxDiameter` | The widest projection of the object
`dip_float` | `minDiameter` | The narrowest projection of the object
`dip_float` | `maxPerpendicular` | The width of the projection perpendicular to `minDiameter`
`dip_float` | `maxAngle` | The angle of the projection for `maxDiameter`
`dip_float` | `minAngle` | The angle of the projection for `minDiameter`

`ConvexHullGetFeret` is the function used by `Measure` for the `FeatureFeret` measurement.

## ARGUMENTS

Data type | Name | Description
`dip_Polygon` | `polygon` | Input convex polygon
`dip_Feret*` | `feret` | Output measurements

## NOTE

This function is more accurate than `ChainCodeGetFeret`, given a correct polygonal representation of the convex hull of the object. Because antipodal pairs are identified, and the angle of the edges is used, this algorithm doesn't depend on an angle step size, as `ChainCodeGetFeret` does.

## LITERATURE

Algorithm A3.7 in M.I. Shamos, "Computational geometry," Ph.D. thesis, Yale University, 1978.

## SEE ALSO

`ChainCodeConvexHull`, `ConvexHullGetArea`, `ConvexHullGetPerimeter`, `ChainCodeGetFeret`