java.awt.geom

Class CubicCurve2D.Float

public static class CubicCurve2D.Float extends CubicCurve2D

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

See Also:

Field Summary
floatctrlx1
The x coordinate of the curve’s first control point.
floatctrlx2
The x coordinate of the curve’s second control point.
floatctrly1
The y coordinate of the curve’s first control point.
floatctrly2
The y coordinate of the curve’s second 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 CubicCurve2D that stores its coordinate values in single-precision floating-point format.
Float(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2)
Constructs a new CubicCurve2D 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 points.
Point2DgetCtrlP1()
Returns the curve’s first control point.
Point2DgetCtrlP2()
Returns the curve’s second control point.
doublegetCtrlX1()
Returns the x coordinate of the curve’s first control point.
doublegetCtrlX2()
Returns the s coordinate of the curve’s second control point.
doublegetCtrlY1()
Returns the y coordinate of the curve’s first control point.
doublegetCtrlY2()
Returns the y coordinate of the curve’s second 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 cx1, double cy1, double cx2, double cy2, double x2, double y2)
Changes the curve geometry, separately specifying each coordinate value as a double-precision floating-point number.
voidsetCurve(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2)
Changes the curve geometry, separately specifying each coordinate value as a single-precision floating-point number.

Field Detail

ctrlx1

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

ctrlx2

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

ctrly1

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

ctrly2

public float ctrly2
The y coordinate of the curve’s second 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 CubicCurve2D 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 cx1, float cy1, float cx2, float cy2, float x2, float y2)
Constructs a new CubicCurve2D that stores its coordinate values in single-precision floating-point format, specifying the initial position of each point.

A drawing of a CubicCurve2D

Parameters: x1 the x coordinate of the curve’s start point. y1 the y coordinate of the curve’s start point. cx1 the x coordinate of the curve’s first control point. cy1 the y coordinate of the curve’s first control point. cx2 the x coordinate of the curve’s second control point. cy2 the y coordinate of the curve’s second 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 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.

An illustration of the bounds of a CubicCurve2D

getCtrlP1

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

getCtrlP2

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

getCtrlX1

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

getCtrlX2

public double getCtrlX2()
Returns the s coordinate of the curve’s second control point.

getCtrlY1

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

getCtrlY2

public double getCtrlY2()
Returns the y coordinate of the curve’s second 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 cx1, double cy1, double cx2, double cy2, double x2, double y2)
Changes the curve geometry, separately specifying each coordinate value as a double-precision floating-point number.

A drawing of a CubicCurve2D

Parameters: x1 the x coordinate of the curve’s new start point. y1 the y coordinate of the curve’s new start point. cx1 the x coordinate of the curve’s new first control point. cy1 the y coordinate of the curve’s new first control point. cx2 the x coordinate of the curve’s new second control point. cy2 the y coordinate of the curve’s new second 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 cx1, float cy1, float cx2, float cy2, float x2, float y2)
Changes the curve geometry, separately specifying each coordinate value as a single-precision floating-point number.

A drawing of a CubicCurve2D

Parameters: x1 the x coordinate of the curve’s new start point. y1 the y coordinate of the curve’s new start point. cx1 the x coordinate of the curve’s new first control point. cy1 the y coordinate of the curve’s new first control point. cx2 the x coordinate of the curve’s new second control point. cy2 the y coordinate of the curve’s new second control point. x2 the x coordinate of the curve’s new end point. y2 the y coordinate of the curve’s new end point.