You are here: Start » AVL.NET » AVL.ShapeConvexity(AvlNet.Path, float)
AVL.ShapeConvexity(AvlNet.Path, float)
| Namespace: | AvlNet |
|---|---|
| Assembly: | AVL.NET.dll |
Syntax
public static void ShapeConvexity( AvlNet.Path inShape, out float outConvexity )
Parameters
- inShape
- Type: AvlNet.Path
- outConvexity
- Type: System.Single
Description
Convexity is a measure of how close a shape is to being convex. Convex shapes have convexity equal to 1.0, while the more concave the shape 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 shape (i.e. it has at least one self-intersection), the computation may lead to results that are not intuitive.
Examples
![]() |
![]() |
Area of the sample shape (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 shape equals to 17529.730/20176.250 = 0.867.
Errors
| Error type | Description |
|---|---|
| DomainError | Open path on input in ShapeConvexity. |
| DomainError | Degenerate shape on input in ShapeConvexity. |


