java.awt.geom

Class QuadCurve2D.Float

public static class QuadCurve2D.Float extends QuadCurve2D

A two-dimensional curve that is parameterized with a quadratic function and stores coordinate values in single-precision floating-point format.

See Also:

Field Summary
floatctrlx
The x coordinate of the curve’s control point.
floatctrly
The y coordinate of the curve’s control point.
floatx1
The x coordinate of the curve’s start point.
floatx2
The x coordinate of the curve’s end point.
floaty1
The y coordinate of the curve’s start point.
floaty2
The y coordinate of the curve’s end point.
Constructor Summary
Float()
Constructs a new QuadCurve2D that stores its coordinate values in single-precision floating-point format.
Float(float x1, float y1, float cx, float cy, float x2, float y2)
Constructs a new QuadCurve2D that stores its coordinate values in single-precision floating-point format, specifying the initial position of each point.
Method Summary
Rectangle2DgetBounds2D()
Determines the smallest rectangle that encloses the curve’s start, end and control point.
Point2DgetCtrlPt()
Returns the curve’s control point.
doublegetCtrlX()
Returns the x coordinate of the curve’s control point.
doublegetCtrlY()
Returns the y coordinate of the curve’s control point.
Point2DgetP1()
Returns the curve’s start point.
Point2DgetP2()
Returns the curve’s end point.
doublegetX1()
Returns the x coordinate of the curve’s start point.
doublegetX2()
Returns the x coordinate of the curve’s end point.
doublegetY1()
Returns the y coordinate of the curve’s start point.
doublegetY2()
Returns the y coordinate of the curve’s end point.
voidsetCurve(double x1, double y1, double cx, double cy, double x2, double y2)
Changes the geometry of the curve, specifying coordinate values as double-precision floating-point numbers.
voidsetCurve(float x1, float y1, float cx, float cy, float x2, float y2)
Changes the geometry of the curve, specifying coordinate values as single-precision floating-point numbers.

Field Detail

ctrlx

public float ctrlx
The x coordinate of the curve’s control point.

ctrly

public float ctrly
The y coordinate of the curve’s control point.

x1

public float x1
The x coordinate of the curve’s start point.

x2

public float x2
The x coordinate of the curve’s end point.

y1

public float y1
The y coordinate of the curve’s start point.

y2

public float y2
The y coordinate of the curve’s end point.

Constructor Detail

Float

public Float()
Constructs a new QuadCurve2D that stores its coordinate values in single-precision floating-point format. All points are initially at position (0, 0).

Float

public Float(float x1, float y1, float cx, float cy, float x2, float y2)
Constructs a new QuadCurve2D that stores its coordinate values in single-precision floating-point format, specifying the initial position of each point.

Parameters: x1 the x coordinate of the curve’s start point. y1 the y coordinate of the curve’s start point. cx the x coordinate of the curve’s control point. cy the y coordinate of the curve’s control point. x2 the x coordinate of the curve’s end point. y2 the y coordinate of the curve’s end point.

Method Detail

getBounds2D

public Rectangle2D getBounds2D()
Determines the smallest rectangle that encloses the curve’s start, end and control point. As the illustration below shows, the invisible control point may cause the bounds to be much larger than the area that is actually covered by the curve.

An illustration of the bounds of a QuadCurve2D

getCtrlPt

public Point2D getCtrlPt()
Returns the curve’s control point.

getCtrlX

public double getCtrlX()
Returns the x coordinate of the curve’s control point.

getCtrlY

public double getCtrlY()
Returns the y coordinate of the curve’s control point.

getP1

public Point2D getP1()
Returns the curve’s start point.

getP2

public Point2D getP2()
Returns the curve’s end point.

getX1

public double getX1()
Returns the x coordinate of the curve’s start point.

getX2

public double getX2()
Returns the x coordinate of the curve’s end point.

getY1

public double getY1()
Returns the y coordinate of the curve’s start point.

getY2

public double getY2()
Returns the y coordinate of the curve’s end point.

setCurve

public void setCurve(double x1, double y1, double cx, double cy, double x2, double y2)
Changes the geometry of the curve, specifying coordinate values as double-precision floating-point numbers.

Parameters: x1 the x coordinate of the curve’s new start point. y1 the y coordinate of the curve’s new start point. cx the x coordinate of the curve’s new control point. cy the y coordinate of the curve’s new control point. x2 the x coordinate of the curve’s new end point. y2 the y coordinate of the curve’s new end point.

setCurve

public void setCurve(float x1, float y1, float cx, float cy, float x2, float y2)
Changes the geometry of the curve, specifying coordinate values as single-precision floating-point numbers.

Parameters: x1 the x coordinate of the curve’s new start point. y1 the y coordinate of the curve’s new start point. cx the x coordinate of the curve’s new control point. cy the y coordinate of the curve’s new control point. x2 the x coordinate of the curve’s new end point. y2 the y coordinate of the curve’s new end point.