If I have an arbitrary polygon like this:
I want to calculate a “centerline” of the polygon. For example for this polygon I imagine a centerline could look something like this:
I tried computing the average angle of the vertexes of the polygon, but that doesn’t work for obvious reasons — e.g. if one angle is 6° and another is 172°, they visually look similar but averaged together they’ll “cancel out”.
The other approach I was thinking of:
- sample a bunch of random points within the polygon
- calculate the least squares best fit line from all of those points
but I feel like there has to be a more sensible way of doing it than that