Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 粗线与矩形相交_Java_Line_Intersection_Rectangles - Fatal编程技术网

Java 粗线与矩形相交

Java 粗线与矩形相交,java,line,intersection,rectangles,Java,Line,Intersection,Rectangles,在Java中,我们可以使用intersects()方法来确定line2D是否与给定的矩形2D相交,但前提是该线的宽度为1像素。 如果我在将basicstroke设置为大于1像素后绘制线条,我如何才能找到该粗线条是否与矩形相交??同样的问题也适用于Quadcurve2D 使用: Shape strokedShape = basicStroke.createStrokedShape(Shape s) 然后,您可以使用strokedShape进行交叉

在Java中,我们可以使用intersects()方法来确定line2D是否与给定的矩形2D相交,但前提是该线的宽度为1像素。 如果我在将basicstroke设置为大于1像素后绘制线条,我如何才能找到该粗线条是否与矩形相交??同样的问题也适用于Quadcurve2D

使用:

Shape strokedShape = basicStroke.createStrokedShape(Shape s)
然后,您可以使用
strokedShape
进行交叉