Interesting article. I’m working on a game that emulates the early days of sailing, trade and exploration. I use a world map as a game board and early on I wanted to detect when the player hit land. In other words I needed to detect the edges of irregular objects (the continents) on a high resolution world map. The code is written in Python using the image module Pillow. I built a function called radar that reaches out an samples the color value of the pixels, then strips out the individual R,G,B values comparing them the the threshold values I have set to determine in the ship is on water or has run into land.
This led to a more challenging game board, one that begins in a European port, but you only see a small circle of the continent, once you sail away from land, all that’s visible is water, but the Pillow module is sampling the colors of the world map hidden from view. With the edge detection of the radar function, when the sailing ship gets near to land (or is ship wrecked by hitting land), a small circle of the land ahoy is made visible until the ship sails away. The radar function looks for land in ever widening circles, so it finds the closest land first, then breaks the loop and announces to the player, “Land ahoy, to the North East.”