Package org.eclipse.gef.geometry.planar
Class QuadraticCurve
java.lang.Object
org.eclipse.gef.geometry.planar.BezierCurve
org.eclipse.gef.geometry.planar.QuadraticCurve
- All Implemented Interfaces:
Serializable
,Cloneable
,ICurve
,IGeometry
,IRotatable<BezierCurve>
,IScalable<BezierCurve>
,ITranslatable<BezierCurve>
Represents the geometric shape of a quadratic Bézier curve.
- See Also:
-
Constructor Summary
ConstructorDescriptionQuadraticCurve
(double... coordinates) Constructs a newQuadraticCurve
from the given sequence of x- and y-coordinates of the start-, the control-, and the end-point.QuadraticCurve
(double x1, double y1, double ctrlX, double ctrlY, double x2, double y2) Constructs a new QuadraticCurve object from the given point coordinates.QuadraticCurve
(Point... points) Constructs a newQuadraticCurve
from the given sequence ofPoint
s formed by start-, control-, and end-point.QuadraticCurve
(Point p1, Point pCtrl, Point p2) Constructs a new QuadraticCurve object from the given points. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Overridden with public visibility as recommended withinCloneable
.getCopy()
Returns a newQuadraticCurve
, which has the same start, end, and control point coordinates as this one.getCtrl()
Get the control point.double
getCtrlX()
Get the control point's x-coordinate.double
getCtrlY()
Get the control point's y-coordinate.Degree elevation: Returns aCubicCurve
representation of thisQuadraticCurve
.final int
hashCode()
Sets the curve's control point.setCtrlX
(double ctrlX) Sets the x-coordinate of the curve's control point.setCtrlY
(double ctrlY) Sets the y-coordinate of the curve's control point.split
(double t) Splits this QuadraticCurve using the de Casteljau algorithm at parameter t into two separate QuadraticCurve objects.toPath()
Transform the QuadraticCurve object to aPath
object with the same shape.toString()
boolean
Methods inherited from class org.eclipse.gef.geometry.planar.BezierCurve
contains, contains, equals, get, getBounds, getClipped, getControlBounds, getDerivative, getIntersections, getIntersections, getOffset, getOverlap, getOverlaps, getP1, getP2, getParameterAt, getPoint, getPoints, getProjection, getRotatedCCW, getRotatedCCW, getRotatedCCW, getRotatedCW, getRotatedCW, getRotatedCW, getScaled, getScaled, getScaled, getScaled, getScaled, getScaled, getTranslated, getTranslated, getX1, getX2, getY1, getY2, intersects, overlaps, overlaps, rotateCCW, rotateCCW, rotateCCW, rotateCW, rotateCW, rotateCW, scale, scale, scale, scale, scale, scale, setP1, setP2, setPoint, toBezier, toCubic, toLine, toLineStrip, toLineStrip, toPoints, toQuadratic, translate, translate
-
Constructor Details
-
QuadraticCurve
public QuadraticCurve(double... coordinates) Constructs a newQuadraticCurve
from the given sequence of x- and y-coordinates of the start-, the control-, and the end-point.- Parameters:
coordinates
- a sequence containing the x- and y-coordinates- See Also:
-
QuadraticCurve
public QuadraticCurve(double x1, double y1, double ctrlX, double ctrlY, double x2, double y2) Constructs a new QuadraticCurve object from the given point coordinates.- Parameters:
x1
- the start point's x-coordinatey1
- the start point's y-coordinatectrlX
- the control point's x-coordinatectrlY
- the control point's y-coordinatex2
- the end point's x-coordinatey2
- the end point's y-coordinate
-
QuadraticCurve
Constructs a newQuadraticCurve
from the given sequence ofPoint
s formed by start-, control-, and end-point.- Parameters:
points
- the controlPoint
s- See Also:
-
QuadraticCurve
Constructs a new QuadraticCurve object from the given points.- Parameters:
p1
- the start pointpCtrl
- the control pointp2
- the end point
-
-
Method Details
-
getCopy
Returns a newQuadraticCurve
, which has the same start, end, and control point coordinates as this one.- Specified by:
getCopy
in interfaceIGeometry
- Overrides:
getCopy
in classBezierCurve
- Returns:
- a new
QuadraticCurve
with the same start, end, and control point coordinates
-
getCtrl
Get the control point.- Returns:
- a Point object representing the control point
-
getCtrlX
public double getCtrlX()Get the control point's x-coordinate.- Returns:
- the control point's x-coordinate
-
getCtrlY
public double getCtrlY()Get the control point's y-coordinate.- Returns:
- the control point's y-coordinate
-
getElevated
Degree elevation: Returns aCubicCurve
representation of thisQuadraticCurve
.- Overrides:
getElevated
in classBezierCurve
- Returns:
- A
CubicCurve
that represents thisQuadraticCurve
.
-
getTransformed
Default implementation returning a transformedPath
representation of thisIGeometry
. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformed
in interfaceIGeometry
- Overrides:
getTransformed
in classBezierCurve
- Parameters:
t
- TheAffineTransform
to be applied- Returns:
- a transformed
Path
representation of thisIGeometry
- See Also:
-
setCtrl
Sets the curve's control point.- Parameters:
ctrl
- The new curve's control point.- Returns:
this
for convenience
-
setCtrlX
Sets the x-coordinate of the curve's control point.- Parameters:
ctrlX
- The new x-coordinate of the curve's control point.- Returns:
this
for convenience
-
setCtrlY
Sets the y-coordinate of the curve's control point.- Parameters:
ctrlY
- The y-coordinate of the curve's control point.- Returns:
this
for convenience
-
split
Splits this QuadraticCurve using the de Casteljau algorithm at parameter t into two separate QuadraticCurve objects. The returnedQuadraticCurve
s are the curves for [0, t] and [t, 1].- Overrides:
split
in classBezierCurve
- Parameters:
t
- in range [0,1]- Returns:
- two QuadraticCurve objects constituting the original curve: 1. [0, t] 2. [t, 1]
-
toPath
Transform the QuadraticCurve object to aPath
object with the same shape.- Specified by:
toPath
in interfaceIGeometry
- Overrides:
toPath
in classBezierCurve
- Returns:
- a
Path
object representing the curve
-
toString
- Overrides:
toString
in classBezierCurve
-
clone
Overridden with public visibility as recommended withinCloneable
. -
hashCode
public final int hashCode() -
touches
Description copied from interface:IGeometry
-