本文整理匯總了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);
}