As part of a small project I'm working on I'm using the Polygon class, but I'm having difficulty with polygons that are "touching" rather than intersecting properly.
For example, in a case where I have two polygons:
Polygon a = new Polygon(new int[] {0,0,3,3}, new int[] {0,1,0,1}, 4);
Polygon b = new Polygon(new int[] {1,1,2,2}, new int[] {1,2,1,2}, 4);
I was checking each point against the other polygon using the contains method, but the code:
System.out.print(a.contains(1,1));
System.out.print(a.contains(2,1));
returns false twice.
Is there some way to detect these "just touching" polygons?