简体   繁体   中英

thick line and rectangle intersection java

In Java We can find whether a line2D intersects a given rectangle2D using the intersects() method, but that is assuming the line is 1 pixel wide. If I draw my line after setting the basicstroke to thicker than 1 pixel how can I find if that thick line intersects the rectangle or not?? Same question applies to Quadcurve2D!!

Use:

Shape strokedShape = basicStroke.createStrokedShape(Shape s)

Then you can do the intersection using the strokedShape .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM