Gohio
Gohio

Reputation: 5

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!!

Upvotes: 0

Views: 289

Answers (1)

camickr
camickr

Reputation: 324177

Use:

Shape strokedShape = basicStroke.createStrokedShape(Shape s)

Then you can do the intersection using the strokedShape.

Upvotes: 2

Related Questions