Is there a mathematical measure of 2D squiggliness?
January 6, 2020 8:29 PM   Subscribe

I'd like to rank several irregular 2D shapes by how "squiggly" their borders are, so I need a good ordinal numerical scale. Their scale varies, so circumference won't cut it. What would be a measure that's valid to, say, a topologist? Maybe a ratio of circumference to area? Is there a better term? Help me help myself on math.stackexchange.com!
posted by paul_smatatoes to Science & Nature (16 answers total) 7 users marked this as a favorite
 
I think what you want is fractal dimension?

https://en.wikipedia.org/wiki/Fractal_dimension
posted by yhlee at 8:36 PM on January 6, 2020 [5 favorites]


How irregular are we talking? Like...multi-sided polygons or crinkly coastlines? Because the latter starts to become fractals and the more crinkly the more the dimensionality changes. I.e. it starts to become 2.5d instead of 2d. Weird, right? (It was the radical differences between coastline measurements in different atlases that led to the discovery of fractals. Basically, the smaller the ruler you use, the longer the coastline becomes.)
posted by sexyrobot at 8:38 PM on January 6, 2020 [3 favorites]


This reminds me of sinuosity.

https://en.m.wikipedia.org/wiki/Sinuosity

http://www.netmaptools.org/Pages/NetMapHelp/channel_sinuosity.htm
posted by cp311 at 8:40 PM on January 6, 2020


Response by poster: @sexyrobot/@yhlee: maybe fractal dimension? it's more crinkly coastlines.
posted by paul_smatatoes at 8:45 PM on January 6, 2020


If the shapes are a single closed loop of a squiggle, you could "unroll" them from 2D to form a linear line in polar co-ordinates (from 0 to 2pi), in relationship of their distance from center to that point of an ideal circle of the same area.

from there, you can define that line in terms of it's non-linear behavior.
posted by nickggully at 9:08 PM on January 6, 2020 [1 favorite]


Try Polsby-Popper, a value proportional to the ratio of area to squared perimeter. It was developed to measure political district compactness and specifically characterizes “squiggliness” of geographic areas.

Reock is another method that requires calculating a minimum bounding circle.
posted by migurski at 9:44 PM on January 6, 2020 [4 favorites]


I'll half-heartedly add curvature to the list of possible answers here -- half-heartedly because it's a local measure (telling you how sharply a curve turns at each point), and it sounds like you want something more global (that assigns a single measurement to the whole curve). But it would help to know more about your problem.

Definitely don't ask topologists what they consider valid. Those are the people who think this thing is a sphere.
posted by aws17576 at 10:39 PM on January 6, 2020 [6 favorites]


Fractal dimension sounds like the right answer!

But since you said the words topologist: a topologist might tell you to compute the persistent homology of some random points of your squiggle.

This is a slightly more refined invariant, emininetly computable and really fun to read about! It turns out that you can recover fractal dimension from persistent homology, so this calculation subsumes the prior. (But, practically, definitely overkill.)
posted by sidek at 11:28 PM on January 6, 2020 [1 favorite]


If the border is smooth, has only a finite number of squiggles, and doesn't contain any straight segments, then for the vast majority of points on the border, tangent segments below a certain size, depending on the point, will either be entirely within or entirely outside the shape except for the point on the border.

But there will be a finite number of points, (the same as the number of squiggles, I think) where every tangent segment below a certain length has points inside the shape on one side of the point on the border, and outside the shape on the other. Points of inflection, you might call them.

Counting those would be a measure of squigglyness, perhaps.
posted by jamjam at 12:47 AM on January 7, 2020


If you're looking for something quick and dirty, you can get something kind of like a fractal dimension by taking the boundary, smoothing it out somehow (e.g. by averaging neighboring points weighted by inverse distance), then dividing its original length by the length of the smoothed version. The greater the ratio, the less smooth the boundary was already.
posted by panic at 2:16 AM on January 7, 2020


Rugosity might be another useful search term in looking at ways that people calculate bumpiness. Imaging software I have can spit out a value for that.
posted by tchemgrrl at 3:42 AM on January 7, 2020 [1 favorite]


If you're talking about gerrymandering there are several measures in use already for how crinkly districts are, like the ratio of the actual circumference to the circumference of a circle of equal area.
posted by GCU Sweet and Full of Grace at 3:57 AM on January 7, 2020


Strictly speaking, if you can actually draw the irregular 2D shape (i.e., it has a finite number of corners connected by smooth curves), then regardless of how squiggly the curves are and how many corners you have, the fractal dimension of the boundary will be 1 and the fractal dimension of the interior will be 2. Fractal dimension is generally only interesting when you have infinitely self-similar shapes with interesting structure on arbitrarily small scales, such as the Koch snowflake or the Mandelbrot set.

In your situation, I would try something like the Polsby-Popper test linked above.
posted by Johnny Assay at 4:17 AM on January 7, 2020 [1 favorite]


Oh, and concerning one of your ideas:

Maybe a ratio of circumference to area?

The Polsby-Popper test is a ratio of circumference squared to the area. The reason you need to square the circumference is that you want a shape to have the same "wiggliness number" when you blow it up uniformly in all directions or shrink it down. But if you double the size of an object, the perimeter doubles while the area quadruples, so the ratio of perimeter to area is halved. The ratio of perimeter squared to area, on the other hand, remains constant.
posted by Johnny Assay at 4:24 AM on January 7, 2020 [7 favorites]


One way to do this is to unwrap the shapes (called radial scanning), and then convert them to a time series, and then you can calculate the sinuosity of the curves.
posted by dhruva at 8:33 AM on January 7, 2020


How about the number of times the concavity of a shape's border changes?
posted by XMLicious at 12:06 PM on January 7, 2020


« Older Why Do We Dread Learning?   |   How to find a general doctor? Newer »
This thread is closed to new comments.