I'm currently writing a program in Java and I'm dealing with polygon objects. I want to create a different color border between touching objects depending on their class (i.e. land, ocean, etc). I need an algorithm for detecting which segments of my ocean border another ocean or land.
Right now I'm trying to do this by detecting which object share coordinates. And creating a total count of each class, and whichever class has the highest count, that is what that segment is bordering. It's too simple and doesn't work in about 40% of the cases, so I need something better.
Can any one recommend a different idea, or a source to look at?
Thanks in advance.