I was wondering if there is any sort of Polygon.double because I need to input two double [] arrays and test whether another point is contained in the polygon. I saw another post about Path2D.double but it doesn't seem to have any similar methods like "contains" in Polygon.
Asked
Active
Viewed 811 times
1 Answers
0
There is a contains(double x, double y) in Polygon and Path2D.Double.
EDIT:
Also check out this post.
-
Sorry ya I know about that my real problem is that I would like my input arrays into Polygon to be double arrays rather than integer arrays – bryan Mar 01 '11 at 19:40
-
Can't you use Path2D.Double to achieve it? – Bala R Mar 01 '11 at 19:44
-
but I can't seem to find a method similar to contains(double x, double y) in Path2D.Double – bryan Mar 01 '11 at 19:52
-
@bryan Path2D.Double exitends Path2D which has `contains(double, double)` Check out the section "Methods inherited from class java.awt.geom.Path2D" in [Path2D.Double](http://download.oracle.com/javase/6/docs/api/java/awt/geom/Path2D.Double.html) – Bala R Mar 01 '11 at 19:59
-
@bryan so you should be able to create a new instance of Path2D.Double, use lineTo() to complete the polygon and call contains() – Bala R Mar 01 '11 at 20:01