Class QuadraticCurve

    • Constructor Detail

      • QuadraticCurve

        public QuadraticCurve​(double x1,
                              double y1,
                              double ctrlX,
                              double ctrlY,
                              double x2,
                              double y2)
        Constructs a new QuadraticCurve object from the given point coordinates.
        Parameters:
        x1 - the start point's x-coordinate
        y1 - the start point's y-coordinate
        ctrlX - the control point's x-coordinate
        ctrlY - the control point's y-coordinate
        x2 - the end point's x-coordinate
        y2 - the end point's y-coordinate
      • QuadraticCurve

        public QuadraticCurve​(Point p1,
                              Point pCtrl,
                              Point p2)
        Constructs a new QuadraticCurve object from the given points.
        Parameters:
        p1 - the start point
        pCtrl - the control point
        p2 - the end point
    • Method Detail

      • getCtrl

        public Point getCtrl()
        Get the control point.
        Returns:
        a Point object representing the control point
      • getCtrlX

        public double getCtrlX()
        Get the control point's x-coordinate.
        Returns:
        the control point's x-coordinate
      • getCtrlY

        public double getCtrlY()
        Get the control point's y-coordinate.
        Returns:
        the control point's y-coordinate
      • setCtrl

        public QuadraticCurve setCtrl​(Point ctrl)
        Sets the curve's control point.
        Parameters:
        ctrl - The new curve's control point.
        Returns:
        this for convenience
      • setCtrlX

        public QuadraticCurve setCtrlX​(double ctrlX)
        Sets the x-coordinate of the curve's control point.
        Parameters:
        ctrlX - The new x-coordinate of the curve's control point.
        Returns:
        this for convenience
      • setCtrlY

        public QuadraticCurve setCtrlY​(double ctrlY)
        Sets the y-coordinate of the curve's control point.
        Parameters:
        ctrlY - The y-coordinate of the curve's control point.
        Returns:
        this for convenience
      • split

        public QuadraticCurve[] split​(double t)
        Splits this QuadraticCurve using the de Casteljau algorithm at parameter t into two separate QuadraticCurve objects. The returned QuadraticCurves are the curves for [0, t] and [t, 1].
        Overrides:
        split in class BezierCurve
        Parameters:
        t - in range [0,1]
        Returns:
        two QuadraticCurve objects constituting the original curve: 1. [0, t] 2. [t, 1]
      • toPath

        public Path toPath()
        Transform the QuadraticCurve object to a Path object with the same shape.
        Specified by:
        toPath in interface IGeometry
        Overrides:
        toPath in class BezierCurve
        Returns:
        a Path object representing the curve
      • clone

        public java.lang.Object clone()
        Overridden with public visibility as recommended within Cloneable .
        Overrides:
        clone in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()