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. 🎉

World map, with an irregular near-quadrilatral drawn such that it approximately connects Inverness (Scotland), Istanbul (Turkey), Cape Town (South Africa), and San Francisco (California, USA), encompassing the area within.

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.

Reply here

Your email address will not be published. Required fields are marked *

Reply on your own site

Reply elsewhere

You can reply to this post on Mastodon (@dan@danq.me), Mastodon (@blog@danq.me).

Reply by email

I'd love to hear what you think. Send an email to b26162@danq.me; be sure to let me know if you're happy for your comment to appear on the Web!