java.awt.geom

Class QuadCurve2D.Float

Enclosing Class:
QuadCurve2D
Implemented Interfaces:
Cloneable, Shape

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:
QuadCurve2D.Double

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 curve’s control point.
float
ctrly
The y coordinate of the curve’s control point.
float
x1
The x coordinate of the curve’s start point.
float
x2
The x coordinate of the curve’s end point.
float
y1
The y coordinate of the curve’s start point.
float
y2
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

Rectangle2D
getBounds2D()
Determines the smallest rectangle that encloses the curve’s start, end and control point.
Point2D
getCtrlPt()
Returns the curve’s control point.
double
getCtrlX()
Returns the x coordinate of the curve’s control point.
double
getCtrlY()
Returns the y coordinate of the curve’s 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 cx, double cy, double x2, double y2)
Changes the geometry of the curve, specifying coordinate values as double-precision floating-point numbers.
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.

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 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 Details

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 Details

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

Specified by:
getBounds2D in interface Shape

getCtrlPt

public Point2D getCtrlPt()
Returns the curve’s control point.
Overrides:
getCtrlPt in interface QuadCurve2D

getCtrlX

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

getCtrlY

public double getCtrlY()
Returns the y coordinate of the curve’s control point.
Overrides:
getCtrlY in interface QuadCurve2D

getP1

public Point2D getP1()
Returns the curve’s start point.
Overrides:
getP1 in interface QuadCurve2D

getP2

public Point2D getP2()
Returns the curve’s end point.
Overrides:
getP2 in interface QuadCurve2D

getX1

public double getX1()
Returns the x coordinate of the curve’s start point.
Overrides:
getX1 in interface QuadCurve2D

getX2

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

getY1

public double getY1()
Returns the y coordinate of the curve’s start point.
Overrides:
getY1 in interface QuadCurve2D

getY2

public double getY2()
Returns the y coordinate of the curve’s end point.
Overrides:
getY2 in interface QuadCurve2D

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.
Overrides:
setCurve in interface QuadCurve2D
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.

QuadCurve2D.java -- represents a parameterized quadratic curve in 2-D space Copyright (C) 2002, 2003, 2004 Free Software Foundation This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.