當前位置: 首頁>>代碼示例>>Java>>正文


Java CubicCurve2D.intersects方法代碼示例

本文整理匯總了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");
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:13,代碼來源:IntersectsTest.java

示例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);
}
 
開發者ID:SQLPower,項目名稱:power-matchmaker,代碼行數:16,代碼來源:IOConnector.java


注:本文中的java.awt.geom.CubicCurve2D.intersects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。