java.awt.geom

Class QuadCurve2D.Float

Enclosing Class:
QuadCurve2D
Implemented Interfaces:
Cloneable, Shape

public static class QuadCurve2D.Float
extends QuadCurve2D

A quadratic parametric curve segment specified with float coordinates.

Nested Class Summary

Nested classes/interfaces inherited from class java.awt.geom.QuadCurve2D

QuadCurve2D.Double, QuadCurve2D.Float

Field Summary

float
ctrlx
The x coordinate of the control point of the quadratic curve segment.
float
ctrly
The y coordinate of the control point of the quadratic curve segment.
float
x1
The x coordinate of the start point of the quadratic curve segment.
float
x2
The x coordinate of the end point of the quadratic curve segment.
float
y1
The y coordinate of the start point of the quadratic curve segment.
float
y2
The y coordinate of the end point of the quadratic curve segment.

Constructor Summary

Float()
Constructs and initializes a QuadCurve2D with coordinates (0, 0, 0, 0, 0, 0).
Float(float x1, float y1, float ctrlx, float ctrly, float x2, float y2)
Constructs and initializes a QuadCurve2D from the specified coordinates.

Method Summary

Rectangle2D
getBounds2D()
Returns the bounding box of this QuadCurve2D.
Point2D
getCtrlPt()
Returns the control point.
double
getCtrlX()
Returns the x coordinate of the control point in double precision.
double
getCtrlY()
Returns the y coordinate of the control point in double precision.
Point2D
getP1()
Returns the start point.
Point2D
getP2()
Returns the end point.
double
getX1()
Returns the x coordinate of the start point in double precision.
double
getX2()
Returns the x coordinate of the end point in double precision.
double
getY1()
Returns the y coordinate of the start point in double precision.
double
getY2()
Returns the y coordinate of the end point in double precision.
void
setCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
Sets the location of the endpoints and controlpoint of this QuadCurve2D to the specified double coordinates.
void
setCurve(float x1, float y1, float ctrlx, float ctrly, float x2, float y2)
Sets the location of the endpoints and controlpoint of this curve to the specified float coordinates.

Methods inherited from class java.awt.geom.QuadCurve2D

clone, contains, contains, contains, contains, getBounds, getCtrlPt, getCtrlX, getCtrlY, getFlatness, getFlatness, getFlatness, getFlatnessSq, getFlatnessSq, getFlatnessSq, getP1, getP2, getPathIterator, getPathIterator, getX1, getX2, getY1, getY2, intersects, intersects, setCurve, setCurve, setCurve, setCurve, setCurve, solveQuadratic, solveQuadratic, subdivide, subdivide, subdivide

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

ctrlx

public float ctrlx
The x coordinate of the control point of the quadratic curve segment.

ctrly

public float ctrly
The y coordinate of the control point of the quadratic curve segment.

x1

public float x1
The x coordinate of the start point of the quadratic curve segment.

x2

public float x2
The x coordinate of the end point of the quadratic curve segment.

y1

public float y1
The y coordinate of the start point of the quadratic curve segment.

y2

public float y2
The y coordinate of the end point of the quadratic curve segment.

Constructor Details

Float

public Float()
Constructs and initializes a QuadCurve2D with coordinates (0, 0, 0, 0, 0, 0).

Float

public Float(float x1,
             float y1,
             float ctrlx,
             float ctrly,
             float x2,
             float y2)
Constructs and initializes a QuadCurve2D from the specified coordinates.
Parameters:
Usages and Demos :

View More Examples of Float(float x1,float y1,float ctrlx,float ctrly,float x2,float y2)
   1:         g.drawString("QuadCurve2D", 10, 20);
   2:         QuadCurve2D quad = new QuadCurve2D.Float(10, 55, 35, 105, 60, 55);
   3:         g.draw(quad);
   4: 
   5:         g.translate(-75, 70);

View Full Code Here
   1:         p2 =  (Point)fPoints.get(1);
   2:     QuadCurve2D quadCurve = new QuadCurve2D.Float(p1.x, p1.y, fControlPoint.x, fControlPoint.y, p2.x, p2.y);
   3:         g2.draw(quadCurve);
   4:         ...
   5:         p2 =  (Point)fPoints.get(1);
   6:     QuadCurve2D quadCurve = new QuadCurve2D.Float(p1.x, p1.y, fControlPoint.x, fControlPoint.y, p2.x, p2.y);
   7:     return quadCurve.contains(x,y);
   8:   }
   9: }

View Full Code Here
   1:                          break;
   2:                 case 2 : shape = new RoundRectangle2D.Float(0.0f, 0.0f, w/5, h/4, 10.0f, 10.0f);
   3:                          break;
   4:         ...
   5:                          break;
   6:                 case 4 : shape = new QuadCurve2D.Float(0.0f,0.0f,w/10, h/2,w/5,0.0f);
   7:                          break;
   8:                 case 5 : shape = new CubicCurve2D.Float(0.0f,0.0f,w/15,h/2, w/10,h/4,w/5,0.0f);
   9:                          break;

View Full Code Here
   1:                 if (i == 0) {
   2:                      shape = new QuadCurve2D.Float(w*.1f,yy,w*.5f,50,w*.9f,yy);
   3:                 } else {
   4:                      shape = new CubicCurve2D.Float(w*.1f,yy,w*.4f,yy-15,
   5:                                             w*.6f,yy+15,w*.9f,yy);

View Full Code Here
   1:                     case PathIterator.SEG_LINETO:  return new       Line2D.Float(x1,y1, buffer[0],buffer[1]);
   2:                     case PathIterator.SEG_QUADTO:  return new  QuadCurve2D.Float(x1,y1, buffer[0],buffer[1], buffer[2],buffer[3]);
   3:                     case PathIterator.SEG_CUBICTO: return new CubicCurve2D.Float(x1,y1, buffer[0],buffer[1], buffer[2],buffer[3], buffer[4],buffer[5]);
   4:                 }
   5:             }

View Full Code Here

Method Details

getBounds2D

public Rectangle2D getBounds2D()
Returns the bounding box of this QuadCurve2D.
Specified by:
getBounds2D in interface Shape
Returns:
a Rectangle2D that is the bounding box of the shape of this QuadCurve2D.

getCtrlPt

public Point2D getCtrlPt()
Returns the control point.
Overrides:
getCtrlPt in interface QuadCurve2D
Returns:
a Point2D that is the control point of this QuadCurve2D.

getCtrlX

public double getCtrlX()
Returns the x coordinate of the control point in double precision.
Overrides:
getCtrlX in interface QuadCurve2D
Returns:
the x coordinate of the control point.

getCtrlY

public double getCtrlY()
Returns the y coordinate of the control point in double precision.
Overrides:
getCtrlY in interface QuadCurve2D
Returns:
the y coordiante of the control point.

getP1

public Point2D getP1()
Returns the start point.
Overrides:
getP1 in interface QuadCurve2D
Returns:
a Point2D object that is the starting point of this QuadCurve2D.

getP2

public Point2D getP2()
Returns the end point.
Overrides:
getP2 in interface QuadCurve2D
Returns:
a Point2D that is the end point of this QuadCurve2D.

getX1

public double getX1()
Returns the x coordinate of the start point in double precision.
Overrides:
getX1 in interface QuadCurve2D
Returns:
the x coordinate of the starting point.

getX2

public double getX2()
Returns the x coordinate of the end point in double precision.
Overrides:
getX2 in interface QuadCurve2D
Returns:
the x coordinate of the end point.

getY1

public double getY1()
Returns the y coordinate of the start point in double precision.
Overrides:
getY1 in interface QuadCurve2D
Returns:
the y coordinate of the starting point.

getY2

public double getY2()
Returns the y coordinate of the end point in double precision.
Overrides:
getY2 in interface QuadCurve2D
Returns:
the y coordiante of the end point.

setCurve

public void setCurve(double x1,
                     double y1,
                     double ctrlx,
                     double ctrly,
                     double x2,
                     double y2)
Sets the location of the endpoints and controlpoint of this QuadCurve2D to the specified double coordinates.
Overrides:
setCurve in interface QuadCurve2D
Parameters:

setCurve

public void setCurve(float x1,
                     float y1,
                     float ctrlx,
                     float ctrly,
                     float x2,
                     float y2)
Sets the location of the endpoints and controlpoint of this curve to the specified float coordinates.
Parameters: