Thursday, October 13, 2016

I know how far it is to the border

I was trying to sleep when the answer came to me.  It's not fully correct yet, but almost.  There's a few implementation details I hope to clear up tomorrow evening.

Almost there!
I've more or less implemented Bresenham's algorithm (line drawing / digital difference analyzer). Once I get the last details ironed out, I can go on to the next steps and stop abusing what is supposed to be a crude elevation-based visualization mechanism to show plate boundaries and percentage distance from plate boundary (border) to centroid.

The key change to make is to follow the line all the way from centroid to the first border beyond the point we're trying to compute the nearest border of.  That way if we're dealing with concave shapes (like above) we can pick better select the nearest border, which may be between the centroid and the border.  It still won't always be correct for portions of some complex concave shapes, but it shall come close enough in most cases.

And now, back to bed.  Now that its not bugging me I can hopefully sleep.

No comments:

Post a Comment