turningdist
Turning-function distance between two polyshape boundaries.
Category: Mathematics > Computational Geometry
Syntax
d = turningdist(PG1, PG2)
Returns a dissimilarity measure between the shapes of PG1 and PG2.
Description
The distance compares the turning functions of the two polygons: the direction of the edge as a function of the arc length along the boundary, with lengths normalized by the perimeter. The measure is intended to ignore translation and uniform scaling, so it focuses on shape rather than position or size.
Both polyshapes must have exactly one boundary; otherwise an error is raised.
Input arguments
PG1, PG2polyshapeobjects, each with a single boundary.
Output arguments
d- Non-negative scalar. It is
0for identical shapes and grows as the shapes differ.
Example
Square versus rectangle
P = polyshape([0 1 1 0], [0 0 1 1]);
Q = polyshape([0 2 2 0], [0 0 1 1]);
d1 = turningdist(P, P)
d2 = turningdist(P, Q)
Output
d1 = 0
d2 = 0.5854