Hello everyone,
Hello everyone - I'm mapping latitude and longitude points to create "boundaries" - then check and see if a point is within those boundaries.
I really like java.awt.Polygon, but my coordinates are not int's, and since they vary in decimal places, I really don't want to convert them to ints - and deal with that.
The following code works - but does anyone know a better way of doing it?
public static void main(String[] args) {
Path2D.Double d = new Path2D.Double();
d.moveTo(39.146038,-84.571381);
d.lineTo(39.147103,-84.325562);
d.lineTo(39.04052,-84.348907);
d.lineTo(39.045853,-84.605713);
d.closePath();
System.out.println(d.contains(39.095963,-84.468384));
}
I'd prefer to not use a third party jar for this, but wouldn't eliminate it from the possibilities. I like polygon because I don't have to start with moveTo() or finish with closePath() - it's handled automatically.
Thanks in advance for the suggestions.