本文整理汇总了Java中java.awt.geom.CubicCurve2D.intersects方法的典型用法代码示例。如果您正苦于以下问题:Java CubicCurve2D.intersects方法的具体用法?Java CubicCurve2D.intersects怎么用?Java CubicCurve2D.intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.CubicCurve2D
的用法示例。
在下文中一共展示了CubicCurve2D.intersects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
CubicCurve2D c = new CubicCurve2D.Double(50.0, 300.0,
150.0, 166.6666717529297,
238.0, 456.66668701171875,
350.0, 300.0);
Rectangle2D r = new Rectangle2D.Double(260, 300, 10, 10);
if (!c.intersects(r)) {
throw new Exception("The rectangle is contained. " +
"intersects(Rectangle2D) should return true");
}
}
示例2: clicked
import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
/**
* Checks, with a certain degree of fuzziness, if the given point intersects
* the visible line of this IOConnector. The amount of fuzziness is controlled
* by the {@link #clickRadius} property.
*
* @param p The point to test, in the parent component's coordinate space
*/
public boolean clicked(Point p) {
Point p1 = parentCom.getOutputPosition(parentNumber);
p1.translate(parentCom.getX(), parentCom.getY());
Point p2 = childCom.getInputPosition(childNumber);
p2.translate(childCom.getX(), childCom.getY());
CubicCurve2D c = createConnectorPath(p1.x, p1.y, p2.x, p2.y);
return c.intersects(p.x - clickRadius, p.y - clickRadius, clickRadius * 2, clickRadius * 2);
}