QuadCurve2D.Double, QuadCurve2D.Float
public abstract class QuadCurve2D extends Object implements Shape, Cloneable
QuadCurve2D class defines a quadratic parametric curve segment in (x,y) coordinate space. This class is only the abstract superclass for all objects that store a 2D quadratic curve segment. The actual storage representation of the coordinates is left to the subclass.
| Modifier and Type | Class | Description | 
|---|---|---|
| static class  | QuadCurve2D.Double | A quadratic parametric curve segment specified with  doublecoordinates. | 
| static class  | QuadCurve2D.Float | A quadratic parametric curve segment specified with  floatcoordinates. | 
| Modifier | Constructor | Description | 
|---|---|---|
| protected  | This is an abstract class that cannot be instantiated directly. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| Object | clone() | Creates a new object of the same class and with the same contents as this object. | 
| boolean | contains | Tests if the specified coordinates are inside the boundary of the  Shape, as described by the definition of insideness. | 
| boolean | contains | Tests if the interior of the  Shapeentirely contains the specified rectangular area. | 
| boolean | contains | Tests if a specified  Point2Dis inside the boundary of theShape, as described by the  definition of insideness. | 
| boolean | contains | Tests if the interior of the  Shapeentirely contains the specifiedRectangle2D. | 
| Rectangle | getBounds() | Returns an integer  Rectanglethat completely encloses theShape. | 
| Rectangle2D | getBounds2D() | Returns a high precision and more accurate bounding box of the  Shapethan thegetBoundsmethod. | 
| abstract Point2D | getCtrlPt() | Returns the control point. | 
| abstract double | getCtrlX() | Returns the X coordinate of the control point in  doubleprecision. | 
| abstract double | getCtrlY() | Returns the Y coordinate of the control point in  doubleprecision. | 
| double | getFlatness() | Returns the flatness, or maximum distance of a control point from the line connecting the end points, of this  QuadCurve2D. | 
| static double | getFlatness | Returns the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the control points stored in the indicated array at the indicated index. | 
| static double | getFlatness | Returns the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the indicated control points. | 
| double | getFlatnessSq() | Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of this  QuadCurve2D. | 
| static double | getFlatnessSq | Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the control points stored in the indicated array at the indicated index. | 
| static double | getFlatnessSq | Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the indicated control points. | 
| abstract Point2D | getP1() | Returns the start point. | 
| abstract Point2D | getP2() | Returns the end point. | 
| PathIterator | getPathIterator | Returns an iteration object that defines the boundary of the shape of this  QuadCurve2D. | 
| PathIterator | getPathIterator | Returns an iteration object that defines the boundary of the flattened shape of this  QuadCurve2D. | 
| abstract double | getX1() | Returns the X coordinate of the start point in  doublein precision. | 
| abstract double | getX2() | Returns the X coordinate of the end point in  doubleprecision. | 
| abstract double | getY1() | Returns the Y coordinate of the start point in  doubleprecision. | 
| abstract double | getY2() | Returns the Y coordinate of the end point in  doubleprecision. | 
| boolean | intersects | Tests if the interior of the  Shapeintersects the interior of a specified rectangular area. | 
| boolean | intersects | Tests if the interior of the  Shapeintersects the interior of a specifiedRectangle2D. | 
| void | setCurve | Sets the location of the end points and control points of this  QuadCurve2Dto thedoublecoordinates at the specified offset in the specified array. | 
| abstract void | setCurve | Sets the location of the end points and control point of this curve to the specified  doublecoordinates. | 
| void | setCurve | Sets the location of the end points and control points of this  QuadCurve2Dto the coordinates of thePoint2Dobjects at the specified offset in the specified array. | 
| void | setCurve | Sets the location of the end points and control point of this  QuadCurve2Dto the specifiedPoint2Dcoordinates. | 
| void | setCurve | Sets the location of the end points and control point of this  QuadCurve2Dto the same as those in the specifiedQuadCurve2D. | 
| static int | solveQuadratic | Solves the quadratic whose coefficients are in the  eqnarray and places the non-complex roots back into the same array, returning the number of roots. | 
| static int | solveQuadratic | Solves the quadratic whose coefficients are in the  eqnarray and places the non-complex roots into theresarray, returning the number of roots. | 
| static void | subdivide | Subdivides the quadratic curve specified by the coordinates stored in the  srcarray at indicessrcoffthroughsrcoff+ 5 and stores the resulting two subdivided curves into the two result arrays at the corresponding indices. | 
| void | subdivide | Subdivides this  QuadCurve2Dand stores the resulting two subdivided curves into theleftandrightcurve parameters. | 
| static void | subdivide | Subdivides the quadratic curve specified by the  srcparameter and stores the resulting two subdivided curves into theleftandrightcurve parameters. | 
protected QuadCurve2D()
public abstract double getX1()
double in precision.public abstract double getY1()
double precision.public abstract Point2D getP1()
Point2D that is the start point of this QuadCurve2D.public abstract double getCtrlX()
double precision.public abstract double getCtrlY()
double precision.public abstract Point2D getCtrlPt()
Point2D that is the control point of this Point2D.public abstract double getX2()
double precision.public abstract double getY2()
double precision.public abstract Point2D getP2()
Point object that is the end point of this Point2D.public abstract void setCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
double coordinates.x1 - the X coordinate of the start pointy1 - the Y coordinate of the start pointctrlx - the X coordinate of the control pointctrly - the Y coordinate of the control pointx2 - the X coordinate of the end pointy2 - the Y coordinate of the end pointpublic void setCurve(double[] coords, int offset)
QuadCurve2D to the double coordinates at the specified offset in the specified array.coords - the array containing coordinate valuesoffset - the index into the array from which to start getting the coordinate values and assigning them to this QuadCurve2D
public void setCurve(Point2D p1, Point2D cp, Point2D p2)
QuadCurve2D to the specified Point2D coordinates.p1 - the start pointcp - the control pointp2 - the end pointpublic void setCurve(Point2D[] pts, int offset)
QuadCurve2D to the coordinates of the Point2D objects at the specified offset in the specified array.pts - an array containing Point2D that define coordinate valuesoffset - the index into pts from which to start getting the coordinate values and assigning them to this QuadCurve2D
public void setCurve(QuadCurve2D c)
QuadCurve2D to the same as those in the specified QuadCurve2D.c - the specified QuadCurve2D
public static double getFlatnessSq(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
x1 - the X coordinate of the start pointy1 - the Y coordinate of the start pointctrlx - the X coordinate of the control pointctrly - the Y coordinate of the control pointx2 - the X coordinate of the end pointy2 - the Y coordinate of the end pointpublic static double getFlatness(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
x1 - the X coordinate of the start pointy1 - the Y coordinate of the start pointctrlx - the X coordinate of the control pointctrly - the Y coordinate of the control pointx2 - the X coordinate of the end pointy2 - the Y coordinate of the end pointpublic static double getFlatnessSq(double[] coords, int offset)
coords - an array containing coordinate valuesoffset - the index into coords from which to to start getting the values from the arraypublic static double getFlatness(double[] coords, int offset)
coords - an array containing coordinate valuesoffset - the index into coords from which to start getting the coordinate valuespublic double getFlatnessSq()
QuadCurve2D.QuadCurve2D.public double getFlatness()
QuadCurve2D.QuadCurve2D.public void subdivide(QuadCurve2D left, QuadCurve2D right)
QuadCurve2D and stores the resulting two subdivided curves into the left and right curve parameters. Either or both of the left and right objects can be the same as this QuadCurve2D or null.left - the QuadCurve2D object for storing the left or first half of the subdivided curveright - the QuadCurve2D object for storing the right or second half of the subdivided curvepublic static void subdivide(QuadCurve2D src, QuadCurve2D left, QuadCurve2D right)
src parameter and stores the resulting two subdivided curves into the left and right curve parameters. Either or both of the left and right objects can be the same as the src object or null.src - the quadratic curve to be subdividedleft - the QuadCurve2D object for storing the left or first half of the subdivided curveright - the QuadCurve2D object for storing the right or second half of the subdivided curvepublic static void subdivide(double[] src, int srcoff, double[] left, int leftoff, double[] right, int rightoff)
src array at indices srcoff through srcoff + 5 and stores the resulting two subdivided curves into the two result arrays at the corresponding indices. Either or both of the left and right arrays can be null or a reference to the same array and offset as the src array. Note that the last point in the first subdivided curve is the same as the first point in the second subdivided curve. Thus, it is possible to pass the same array for left and right and to use offsets such that rightoff equals leftoff + 4 in order to avoid allocating extra storage for this common point.src - the array holding the coordinates for the source curvesrcoff - the offset into the array of the beginning of the the 6 source coordinatesleft - the array for storing the coordinates for the first half of the subdivided curveleftoff - the offset into the array of the beginning of the the 6 left coordinatesright - the array for storing the coordinates for the second half of the subdivided curverightoff - the offset into the array of the beginning of the the 6 right coordinatespublic static int solveQuadratic(double[] eqn)
eqn array and places the non-complex roots back into the same array, returning the number of roots. The quadratic solved is represented by the equation: 
     eqn = {C, B, A};
     ax^2 + bx + c = 0
  A return value of -1 is used to distinguish a constant equation, which might be always 0 or never 0, from an equation that has no zeroes.eqn - the array that contains the quadratic coefficients-1 if the equation is a constantpublic static int solveQuadratic(double[] eqn, double[] res)
eqn array and places the non-complex roots into the res array, returning the number of roots. The quadratic solved is represented by the equation: 
     eqn = {C, B, A};
     ax^2 + bx + c = 0
  A return value of -1 is used to distinguish a constant equation, which might be always 0 or never 0, from an equation that has no zeroes.eqn - the specified array of coefficients to use to solve the quadratic equationres - the array that contains the non-complex roots resulting from the solution of the quadratic equation-1 if the equation is a constant.public boolean contains(double x, double y)
Shape, as described by the definition of insideness.public boolean contains(Point2D p)
Point2D is inside the boundary of the Shape, as described by the  definition of insideness.public boolean intersects(double x, double y, double w, double h)
Shape intersects the interior of a specified rectangular area. The rectangular area is considered to intersect the Shape if any point is contained in both the interior of the Shape and the specified rectangular area.  The Shape.intersects() method allows a Shape implementation to conservatively return true when: 
Shape intersect, but Shapes this method might return true even though the rectangular area does not intersect the Shape. The Area class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required.intersects in interface Shape
x - the X coordinate of the upper-left corner of the specified rectangular areay - the Y coordinate of the upper-left corner of the specified rectangular areaw - the width of the specified rectangular areah - the height of the specified rectangular areatrue if the interior of the Shape and the interior of the rectangular area intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.public boolean intersects(Rectangle2D r)
Shape intersects the interior of a specified Rectangle2D. The Shape.intersects() method allows a Shape implementation to conservatively return true when: Rectangle2D and the Shape intersect, but Shapes this method might return true even though the Rectangle2D does not intersect the Shape. The Area class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required.intersects in interface Shape
r - the specified Rectangle2D
true if the interior of the Shape and the interior of the specified Rectangle2D intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.public boolean contains(double x, double y, double w, double h)
Shape entirely contains the specified rectangular area. All coordinates that lie inside the rectangular area must lie within the Shape for the entire rectangular area to be considered contained within the Shape.  The Shape.contains() method allows a Shape implementation to conservatively return false when: 
intersect method returns true and Shape entirely contains the rectangular area are prohibitively expensive. Shapes this method might return false even though the Shape contains the rectangular area. The Area class performs more accurate geometric computations than most Shape objects and therefore can be used if a more precise answer is required.contains in interface Shape
x - the X coordinate of the upper-left corner of the specified rectangular areay - the Y coordinate of the upper-left corner of the specified rectangular areaw - the width of the specified rectangular areah - the height of the specified rectangular areatrue if the interior of the Shape entirely contains the specified rectangular area; false otherwise or, if the Shape contains the rectangular area and the intersects method returns true and the containment calculations would be too expensive to perform.public boolean contains(Rectangle2D r)
Shape entirely contains the specified Rectangle2D. The Shape.contains() method allows a Shape implementation to conservatively return false when: intersect method returns true and Shape entirely contains the Rectangle2D are prohibitively expensive. Shapes this method might return false even though the Shape contains the Rectangle2D. The Area class performs more accurate geometric computations than most Shape objects and therefore can be used if a more precise answer is required.contains in interface Shape
r - The specified Rectangle2D
true if the interior of the Shape entirely contains the Rectangle2D; false otherwise or, if the Shape contains the Rectangle2D and the intersects method returns true and the containment calculations would be too expensive to perform.public Rectangle2D getBounds2D()
Shape than the getBounds method. Note that there is no guarantee that the returned Rectangle2D is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated Rectangle2D. The bounding box returned by this method is usually tighter than that returned by the getBounds method and never fails due to overflow problems since the return value can be an instance of the Rectangle2D that uses double precision values to store the dimensions.  Note that the definition of insideness can lead to situations where points on the defining outline of the shape may not be considered contained in the returned bounds object, but only in cases where those points are also not considered contained in the original shape. 
 If a point is inside the shape according to the contains(point) method, then it must be inside the returned Rectangle2D bounds object according to the contains(point) method of the bounds. Specifically: 
 shape.contains(p) requires bounds.contains(p) 
 If a point is not inside the shape, then it might still be contained in the bounds object: 
 bounds.contains(p) does not imply shape.contains(p) 
getBounds2D in interface Shape
Rectangle2D that is a high-precision bounding box of the Shape.public Rectangle getBounds()
Rectangle that completely encloses the Shape. Note that there is no guarantee that the returned Rectangle is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated Rectangle. The returned Rectangle might also fail to completely enclose the Shape if the Shape overflows the limited range of the integer data type. The getBounds2D method generally returns a tighter bounding box due to its greater flexibility in representation.  Note that the definition of insideness can lead to situations where points on the defining outline of the shape may not be considered contained in the returned bounds object, but only in cases where those points are also not considered contained in the original shape. 
 If a point is inside the shape according to the contains(point) method, then it must be inside the returned Rectangle bounds object according to the contains(point) method of the bounds. Specifically: 
 shape.contains(x,y) requires bounds.contains(x,y) 
 If a point is not inside the shape, then it might still be contained in the bounds object: 
 bounds.contains(x,y) does not imply shape.contains(x,y) 
public PathIterator getPathIterator(AffineTransform at)
QuadCurve2D. The iterator for this class is not multi-threaded safe, which means that this QuadCurve2D class does not guarantee that modifications to the geometry of this QuadCurve2D object do not affect any iterations of that geometry that are already in process.getPathIterator in interface Shape
at - an optional AffineTransform to apply to the shape boundaryPathIterator object that defines the boundary of the shape.public PathIterator getPathIterator(AffineTransform at, double flatness)
QuadCurve2D. The iterator for this class is not multi-threaded safe, which means that this QuadCurve2D class does not guarantee that modifications to the geometry of this QuadCurve2D object do not affect any iterations of that geometry that are already in process.getPathIterator in interface Shape
at - an optional AffineTransform to apply to the boundary of the shapeflatness - the maximum distance that the control points for a subdivided curve can be with respect to a line connecting the end points of this curve before this curve is replaced by a straight line connecting the end points.PathIterator object that defines the flattened boundary of the shape.public Object clone()
clone in class Object
OutOfMemoryError - if there is not enough memory.
    © 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
    https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/geom/QuadCurve2D.html