Hello
I want to catch mouse clicks on drawn lines and was dumbfound by the
Line2D.intersec ts method.
My code looks like this:
Line2D.Double l = new Line2D.Double(0 , 0, 100, 100);
if(l.intersects (49, 49, 51, 51)) System.out.prin tln("1");
if(l.intersects (35, 35, 37, 37)) System.out.prin tln("2");
The line (0,0)-(100,100) definitely doesn't intersect with the
rectangle (35,35)-(37,37). But why the hell does the above code give
the output "1" and "2"?!
I hope somebody can eliminate my confusion.
Dominik
I want to catch mouse clicks on drawn lines and was dumbfound by the
Line2D.intersec ts method.
My code looks like this:
Line2D.Double l = new Line2D.Double(0 , 0, 100, 100);
if(l.intersects (49, 49, 51, 51)) System.out.prin tln("1");
if(l.intersects (35, 35, 37, 37)) System.out.prin tln("2");
The line (0,0)-(100,100) definitely doesn't intersect with the
rectangle (35,35)-(37,37). But why the hell does the above code give
the output "1" and "2"?!
I hope somebody can eliminate my confusion.
Dominik
Comment