Geocaching Convex Hull now includes Turkey

Thanks to finding a couple of geocaches here in Istanbul, my geocaching "2D convex hull" (the smallest possible convex polygon that covers an area), which I wrote some code to draw last year, just expanded a little further to the East. ๐ŸŽ‰

I've got a lot of the world left still to encircle, but I'm slowly extending my reach...

(previous map, for comparison: https://danq.me/_q23u/2024/04/dans-geoing-hull-2024-04-03.webp)

2 comments

  1. vicarvernon vicarvernon says:

    do you take the farthest N, E, S, W coordinates to map this?

    1. Dan Q Dan Q says:

      Not quite. It's easiest perhaps to visualise a convex hull algorithm like this:

      1. For the first three points, draw a triangle that connects them.
      2. For each subsequent point:
      - if it falls within the shape you've drawn - ignore it,
      - if it doesn't, turn the nearest side of your shape into two sides, with a vertex at your new point

      That's not actually the algorithm I use - I use one called the Monotone Chain (explanation and my source code). But the result is still the same: the smallest possible 2D shape that covers a set of points without any concave parts.

Leave a comment

Reply on your own site