bounds of line2d

T

Thorsten Kiefer

Hi,
the following code
System.err.println(new Line2D.Double(0,0,20,20).getBounds2D());
System.err.println(new Area(new Line2D.Double(0,0,20,20)).getBounds2D());

produces the following output :
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=20.0,h=20.0]
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=0.0,h=0.0]

Is there a way to make the area object have the same boundaries
as the line object ?

Best Regards
Thorsten
 
T

Thorsten Kiefer

Thorsten said:
Hi,
the following code
System.err.println(new Line2D.Double(0,0,20,20).getBounds2D());
System.err.println(new Area(new
Line2D.Double(0,0,20,20)).getBounds2D());

produces the following output :
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=20.0,h=20.0]
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=0.0,h=0.0]

Is there a way to make the area object have the same boundaries
as the line object ?

Best Regards
Thorsten

is it a bug or a feature ?
 
J

Jeff Higgins

Thorsten said:
Hi,
the following code
System.err.println(new Line2D.Double(0,0,20,20).getBounds2D());
System.err.println(new Area(new Line2D.Double(0,0,20,20)).getBounds2D());

produces the following output :
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=20.0,h=20.0]
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=0.0,h=0.0]

Is there a way to make the area object have the same boundaries
as the line object ?

Best Regards
Thorsten
from the javadocs - "Only closed paths and sub-paths are stored".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top