org.openimaj.math.geometry.shape.algorithm

## Class ConvexityDefect

• ```public class ConvexityDefect
extends Object```
Class representing a convexity defect of a polygon, with methods for finding said defects. A convexity defect is a triangle formed between two points on the convex hull of a polygon, and the deepest point on the shape polygon between the points on the hull.
Author:
Jonathon Hare (jsh2@ecs.soton.ac.uk)
• ### Field Summary

Fields
Modifier and Type Field and Description
`Point2d` `deepestPoint`
The deepest point on the shape polygon
`float` `depth`
The depth of the deepest point
`Point2d` `end`
The ending point on the convex hull
`Point2d` `start`
The starting point on the convex hull
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static List<ConvexityDefect>` `findDefects(Polygon p)`
Find the defects of the given polygon.
`static List<ConvexityDefect>` ```findDefects(Polygon p, Polygon hull)```
Find the defects of the given polygon, based on the given convex hull
`Triangle` `getTriangle()`
Get the triangle represented by this defect.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### start

`public Point2d start`
The starting point on the convex hull
• #### end

`public Point2d end`
The ending point on the convex hull
• #### deepestPoint

`public Point2d deepestPoint`
The deepest point on the shape polygon
• #### depth

`public float depth`
The depth of the deepest point
• ### Method Detail

• #### getTriangle

`public Triangle getTriangle()`
Get the triangle represented by this defect.
Returns:
the triangle represented by this defect.
• #### findDefects

`public static List<ConvexityDefect> findDefects(Polygon p)`
Find the defects of the given polygon. The convex hull of the polygon is computed internally.
Parameters:
`p` - the polygon
Returns:
a list of all the convexity defexts
• #### findDefects

```public static List<ConvexityDefect> findDefects(Polygon p,
Polygon hull)```
Find the defects of the given polygon, based on the given convex hull
Parameters:
`p` - the polygon
`hull` - the convex hull of the polygon
Returns:
a list of all the convexity defexts