Back to Aurora Vision Library website

You are here: Start » Function Reference » Path » Polygon Features » PolygonConvexity

PolygonConvexity


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Computes the area of a polygon divided by the area of its convex hull.

Syntax

C++
C#
 
void avl::PolygonConvexity
(
	const avl::Path& inPolygon,
	float& outConvexity
)

Parameters

Name Type Default Description
Input value inPolygon const Path&
Output value outConvexity float&

Description

Convexity is a measure of how close a polygon is to being convex. Convex polygons have convexity equal to 1.0, while the more concave the polygon is, the closer to 0.0 is its convexity.

Mathematically, the convexity is calculated as follows:

Note that if the input path is not a valid polygon (i.e. it has at least one self-intersection), the computation may lead to results that are not intuitive.

Examples

Area of the sample polygon (on the left) equals to 17529.730, while area of its convex hull (on the right) equals to 20176.250, so the convexity of the polygon equals to 17529.730/20176.250 = 0.867.

Errors

List of possible exceptions:

Error type Description
DomainError Degenerate polygon on input in PolygonConvexity.
DomainError Open path on input in PolygonConvexity.

See Also

  • RegionConvexity – Computes the area of a region divided by area of its convex hull.
  • PathConvexHull – Computes the smallest convex shape that contains the given path.
  • PolygonElongation – Computes the elongation factor of a polygon (perfect circle has minimal elongation equal 1.0).
  • PolygonCircularity – Computes the area of a polygon divided by the area of a circle having the same feature.