computeDirection

Function

Common
fun Path.computeDirection(): Path.Direction

Computes this Path's direction (or winding, or orientation), which can be either Path.Direction.Clockwise or Path.Direction.CounterClockwise.

If the path is made of multiple contours (the path contains multiple "move" commands), the direction returned by this property is the direction of the first contour.

If the path is empty (contains no lines/curves), the direction is Path.Direction.Clockwise.

If the path has no area (single straight line), the direction is Path.Direction.Clockwise.

Calling this property does not cache the result, the direction is computed Calling this method does not cache the result, the direction is computed every time the method is called.

If you need to query the direction of individual contours, you should divide the path first.