⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cubiccurve2d.java

📁 kaffe Java 解释器语言,源码,Java的子集系统,开放源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
   *   * <p>The above drawing illustrates in which area points are   * considered &#x201c;contained&#x201d; in a CubicCurve2D.   */  public boolean contains(double x, double y)  {    // XXX Implement.    throw new Error("not implemented");  }  /**   * Determines whether a point lies inside the area that is bounded   * by the curve and the straight line connecting its end points.   *   * <p><img src="doc-files/CubicCurve2D-5.png" width="350" height="180"   * alt="A drawing of the area spanned by the curve" />   *   * <p>The above drawing illustrates in which area points are   * considered &#x201c;contained&#x201d; in a CubicCurve2D.   */  public boolean contains(Point2D p)  {    return contains(p.getX(), p.getY());  }  public boolean intersects(double x, double y, double w, double h)  {    // XXX Implement.    throw new Error("not implemented");  }  public boolean intersects(Rectangle2D r)  {    return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());  }  public boolean contains(double x, double y, double w, double h)  {    // XXX Implement.    throw new Error("not implemented");  }  public boolean contains(Rectangle2D r)  {    return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());  }  /**   * Determines the smallest rectangle that encloses the   * curve&#x2019;s start, end and control points. As the illustration   * below shows, the invisible control points may cause the bounds to   * be much larger than the area that is actually covered by the   * curve.   *   * <p><img src="doc-files/CubicCurve2D-2.png" width="350" height="180"   * alt="An illustration of the bounds of a CubicCurve2D" />   */  public Rectangle getBounds()  {    return getBounds2D().getBounds();  }  public PathIterator getPathIterator(final AffineTransform at)  {    return new PathIterator()    {      /** Current coordinate. */      private int current = 0;      public int getWindingRule()      {        return WIND_NON_ZERO;      }      public boolean isDone()      {        return current >= 2;      }      public void next()      {        current++;      }      public int currentSegment(float[] coords)      {        int result;        switch (current)          {          case 0:            coords[0] = (float) getX1();            coords[1] = (float) getY1();            result = SEG_MOVETO;            break;                      case 1:            coords[0] = (float) getCtrlX1();            coords[1] = (float) getCtrlY1();            coords[2] = (float) getCtrlX2();            coords[3] = (float) getCtrlY2();            coords[4] = (float) getX2();            coords[5] = (float) getY2();            result = SEG_CUBICTO;            break;          default:            throw new NoSuchElementException("cubic iterator out of bounds");                      }        if (at != null)          at.transform(coords, 0, coords, 0, 3);        return result;      }      public int currentSegment(double[] coords)      {        int result;        switch (current)          {          case 0:            coords[0] = getX1();            coords[1] = getY1();            result = SEG_MOVETO;            break;          case 1:            coords[0] = getCtrlX1();            coords[1] = getCtrlY1();            coords[2] = getCtrlX2();            coords[3] = getCtrlY2();            coords[4] = getX2();            coords[5] = getY2();            result = SEG_CUBICTO;            break;          default:            throw new NoSuchElementException("cubic iterator out of bounds");          }                if (at != null)          at.transform(coords, 0, coords, 0, 3);        return result;      }    };  }  public PathIterator getPathIterator(AffineTransform at, double flatness)  {    return new FlatteningPathIterator(getPathIterator(at), flatness);  }  /**   * Create a new curve with the same contents as this one.   *   * @return the clone.   */  public Object clone()  {    try    {      return super.clone();    }    catch (CloneNotSupportedException e)    {      throw (Error) new InternalError().initCause(e); // Impossible    }  }  /**   * A two-dimensional curve that is parameterized with a cubic   * function and stores coordinate values in double-precision   * floating-point format.   *   * @see CubicCurve2D.Float   *   * @author Eric Blake (ebb9@email.byu.edu)   * @author Sascha Brawer (brawer@dandelis.ch)   */  public static class Double    extends CubicCurve2D  {    /**     * The <i>x</i> coordinate of the curve&#x2019;s start point.     */    public double x1;    /**     * The <i>y</i> coordinate of the curve&#x2019;s start point.     */    public double y1;    /**     * The <i>x</i> coordinate of the curve&#x2019;s first control point.     */    public double ctrlx1;    /**     * The <i>y</i> coordinate of the curve&#x2019;s first control point.     */    public double ctrly1;    /**     * The <i>x</i> coordinate of the curve&#x2019;s second control point.     */    public double ctrlx2;    /**     * The <i>y</i> coordinate of the curve&#x2019;s second control point.     */    public double ctrly2;    /**     * The <i>x</i> coordinate of the curve&#x2019;s end point.     */    public double x2;    /**     * The <i>y</i> coordinate of the curve&#x2019;s end point.     */    public double y2;    /**     * Constructs a new CubicCurve2D that stores its coordinate values     * in double-precision floating-point format. All points are     * initially at position (0, 0).     */    public Double()    {    }    /**     * Constructs a new CubicCurve2D that stores its coordinate values     * in double-precision floating-point format, specifying the     * initial position of each point.     *     * <p><img src="doc-files/CubicCurve2D-1.png" width="350" height="180"     * alt="A drawing of a CubicCurve2D" />     *     * @param x1 the <i>x</i> coordinate of the curve&#x2019;s start     * point.     *     * @param y1 the <i>y</i> coordinate of the curve&#x2019;s start     * point.     *     * @param cx1 the <i>x</i> coordinate of the curve&#x2019;s first     * control point.     *     * @param cy1 the <i>y</i> coordinate of the curve&#x2019;s first     * control point.     *     * @param cx2 the <i>x</i> coordinate of the curve&#x2019;s second     * control point.     *     * @param cy2 the <i>y</i> coordinate of the curve&#x2019;s second     * control point.     *     * @param x2 the <i>x</i> coordinate of the curve&#x2019;s end     * point.     *     * @param y2 the <i>y</i> coordinate of the curve&#x2019;s end     * point.     */    public Double(double x1, double y1, double cx1, double cy1,                  double cx2, double cy2, double x2, double y2)    {      this.x1 = x1;      this.y1 = y1;      ctrlx1 = cx1;      ctrly1 = cy1;      ctrlx2 = cx2;      ctrly2 = cy2;      this.x2 = x2;      this.y2 = y2;    }    /**     * Returns the <i>x</i> coordinate of the curve&#x2019;s start     * point.     */    public double getX1()    {      return x1;    }    /**     * Returns the <i>y</i> coordinate of the curve&#x2019;s start     * point.     */    public double getY1()    {      return y1;    }    /**     * Returns the curve&#x2019;s start point.     */    public Point2D getP1()    {      return new Point2D.Double(x1, y1);    }    /**     * Returns the <i>x</i> coordinate of the curve&#x2019;s first     * control point.     */    public double getCtrlX1()    {      return ctrlx1;    }    /**     * Returns the <i>y</i> coordinate of the curve&#x2019;s first     * control point.     */    public double getCtrlY1()    {      return ctrly1;    }    /**     * Returns the curve&#x2019;s first control point.     */    public Point2D getCtrlP1()    {      return new Point2D.Double(ctrlx1, ctrly1);    }    /**     * Returns the <i>x</i> coordinate of the curve&#x2019;s second     * control point.     */    public double getCtrlX2()    {      return ctrlx2;    }    /**     * Returns the <i>y</i> coordinate of the curve&#x2019;s second     * control point.     */    public double getCtrlY2()    {      return ctrly2;    }    /**     * Returns the curve&#x2019;s second control point.     */    public Point2D getCtrlP2()    {      return new Point2D.Double(ctrlx2, ctrly2);    }    /**     * Returns the <i>x</i> coordinate of the curve&#x2019;s end     * point.     */    public double getX2()    {      return x2;    }    /**     * Returns the <i>y</i> coordinate of the curve&#x2019;s end     * point.     */    public double getY2()    {      return y2;    }    /**     * Returns the curve&#x2019;s end point.     */    public Point2D getP2()    {      return new Point2D.Double(x2, y2);    }    /**     * Changes the curve geometry, separately specifying each coordinate     * value.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -