java.awt.geom
Class CubicCurve2D.Double

java.lang.Object
  extended by java.awt.geom.CubicCurve2D
      extended by java.awt.geom.CubicCurve2D.Double
All Implemented Interfaces:
Shape, Cloneable
Enclosing class:
CubicCurve2D

public static class CubicCurve2D.Double
extends CubicCurve2D

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

See Also:
CubicCurve2D.Float

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.CubicCurve2D
CubicCurve2D.Double, CubicCurve2D.Float
 
Field Summary
 double ctrlx1
          The x coordinate of the curve’s first control point.
 double ctrlx2
          The x coordinate of the curve’s second control point.
 double ctrly1
          The y coordinate of the curve’s first control point.
 double ctrly2
          The y coordinate of the curve’s second control point.
 double x1
          The x coordinate of the curve’s start point.
 double x2
          The x coordinate of the curve’s end point.
 double y1
          The y coordinate of the curve’s start point.
 double y2
          The y coordinate of the curve’s end point.
 
Constructor Summary
CubicCurve2D.Double()
          Constructs a new CubicCurve2D that stores its coordinate values in double-precision floating-point format.
CubicCurve2D.Double(double x1, double y1, double cx1, double cy1, double cx2, double cy2, double x2, double y2)
          Constructs a new CubicCurve2D that stores its coordinate values in double-precision floating-point format, specifying the initial position of each point.
 
Method Summary
 Rectangle2D getBounds2D()
          Determines the smallest rectangle that encloses the curve’s start, end and control points.
 Point2D getCtrlP1()
          Returns the curve’s first control point.
 Point2D getCtrlP2()
          Returns the curve’s second control point.
 double getCtrlX1()
          Returns the x coordinate of the curve’s first control point.
 double getCtrlX2()
          Returns the x coordinate of the curve’s second control point.
 double getCtrlY1()
          Returns the y coordinate of the curve’s first control point.
 double getCtrlY2()
          Returns the y coordinate of the curve’s second control point.
 Point2D getP1()
          Returns the curve’s start point.
 Point2D getP2()
          Returns the curve’s end point.
 double getX1()
          Returns the x coordinate of the curve’s start point.
 double getX2()
          Returns the x coordinate of the curve’s end point.
 double getY1()
          Returns the y coordinate of the curve’s start point.
 double getY2()
          Returns the y coordinate of the curve’s end point.
 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.
 
Methods inherited from class java.awt.geom.CubicCurve2D
clone, contains, contains, contains, contains, getBounds, getFlatness, getFlatness, getFlatness, getFlatnessSq, getFlatnessSq, getFlatnessSq, getPathIterator, getPathIterator, intersects, intersects, setCurve, setCurve, setCurve, setCurve, solveCubic, solveCubic, subdivide, subdivide, subdivide
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x1

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


y1

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


ctrlx1

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


ctrly1

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


ctrlx2

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


ctrly2

public double ctrly2
The y coordinate of the curve’s second control point.


x2

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


y2

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

Constructor Detail

CubicCurve2D.Double

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


CubicCurve2D.Double

public CubicCurve2D.Double(double x1,
                           double y1,
                           double cx1,
                           double cy1,
                           double cx2,
                           double cy2,
                           double x2,
                           double y2)
Constructs a new CubicCurve2D that stores its coordinate values in double-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

getX1

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

Specified by:
getX1 in class CubicCurve2D

getY1

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

Specified by:
getY1 in class CubicCurve2D

getP1

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

Specified by:
getP1 in class CubicCurve2D

getCtrlX1

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

Specified by:
getCtrlX1 in class CubicCurve2D

getCtrlY1

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

Specified by:
getCtrlY1 in class CubicCurve2D

getCtrlP1

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

Specified by:
getCtrlP1 in class CubicCurve2D

getCtrlX2

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

Specified by:
getCtrlX2 in class CubicCurve2D

getCtrlY2

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

Specified by:
getCtrlY2 in class CubicCurve2D

getCtrlP2

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

Specified by:
getCtrlP2 in class CubicCurve2D

getX2

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

Specified by:
getX2 in class CubicCurve2D

getY2

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

Specified by:
getY2 in class CubicCurve2D

getP2

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

Specified by:
getP2 in class CubicCurve2D

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.

A drawing of a CubicCurve2D

Specified by:
setCurve in class 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.

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

Returns:
the shape's bounding box
See Also:
Shape.getBounds()