Wednesday, December 26, 2018

Barrier Islands Revisited

One of my motivations for rewriting Dragons Abound so that land masses don't have to conform to the underlying Delauney triangulation of the world was the problems I encountered in implementing barrier islands.  Now that the rewrite is done, I want to revisit barrier islands and take advantage of the new capabilities.

Recall that barrier islands are flat or lumpy areas of sand that form by wave and tidal action parallel to the mainland coast.  That often occur in long chains that may go on for many tens of miles.  The barrier islands are often separated by small tidal inlets, and may form lagoons between the islands and the mainland.  North Carolina's Outer Banks are a typical example:

When I implemented barrier islands for Dragons Abound, I was forced to make the islands at least a couple of locations thick.  If I tried to make islands that were just one location thick, the underlying triangles become very obvious in the outline of the island:
Now that I can draw a land mass without regard to the underlying locations, I can make a thin, smooth barrier island.

My original implementation of barrier islands worked by creating an outline where I wanted the island to be, and then turned any of the underlying Delauney triangles within the outline to land.  Now that I can define land as polygons, I don't need the second step of turning on the underlying triangles.  I can just use that outline directly as the barrier island:
But as you can see, the outline I create isn't quite perfect -- it folds back on itself near the bottom end.  When you project a line in a direction as I do here to create the polygon, it can create some weird shapes.  When I was just using this as a way to locate land locations, this was irrelevant.  But now that I'm using this directly, I'm going to have to clean it up and make it look more like an island.

I do a couple of things to improve the island outline.  First of all, instead of projecting from the actual coast, I project from a smooth version of the coast that removes most of the small folds and bumps.  Second, I scan through the outline and clip away any self-intersections where the island coastline crosses itself.  Finally, I cap the ends of the islands with arcs rather than just a straight line connecting the inside to the outside.

Here is a (zoomed in) example of a cleaned up, narrow barrier island:
If you look at natural barrier islands you'll see that the outward facing sides of the islands tend to be smooth while the insides are more irregular.  Presumably these islands are mostly sand, and the wave action on the outside tends to smooth them out, while the protected insides can be more irregular.  I can simulate that by adding some noise to the inside of the barrier island profile:

Here's an example of a possible problem:
Because it was created in a narrow inlet, the barrier island is overlapping the coast.  When land is tied to the underlying locations, it isn't possible for two land masses to overlap.  (They just end up merged.)  But now that the shape of the island isn't tied to the underlying locations, I need to add some smarts to keep from getting implausible results.

The first step in improving the placement is to identify all the bays on the coastline and keep barrier islands out of the bays.  Detecting the bays uses the method I described in this post; the basic idea is to measure the sinuosity of the coastline where I'm going to place the island and avoid any spots where the sinuosity is high.  This will cause the barrier islands to largely end up on flat spots on the coastline.  There are a few other rules that help with placement.  I avoid any coastlines that are too short -- this avoids creating barrier islands off of small islands.  I also avoid overlapping any existing barrier islands.  Finally, I check to see if the barrier island overlaps with any of the existing coastlines.  If it does, I reject it.  (Alternatively, I could try merging it with the coastline.)

The one improvement I'd still like to make is to add some small breaks into the islands, similar to what happens at the south end of the North Carolina Outer Banks.  That's on the TODO list for now.



2 comments:

  1. when a barrier island overlaps and merges with the coast, it is sometimes called a "spit" like Sandy Hook (NJ) in miniature

    ReplyDelete
    Replies
    1. I probably should allow that -- it's just easier to reject it than to merge it with the coastline.

      Delete