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

public class QuadraticCurve extends BezierCurve
Represents the geometric shape of a quadratic Bézier curve.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`QuadraticCurve(double... coordinates)`
Constructs a new `QuadraticCurve` 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 new `QuadraticCurve` from the given sequence of `Point`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 Type
Method
Description
`Object`
`clone()`
Overridden with public visibility as recommended within `Cloneable` .
`QuadraticCurve`
`getCopy()`
Returns a new `QuadraticCurve`, which has the same start, end, and control point coordinates as this one.
`Point`
`getCtrl()`
Get the control point.
`double`
`getCtrlX()`
Get the control point's x-coordinate.
`double`
`getCtrlY()`
Get the control point's y-coordinate.
`CubicCurve`
`getElevated()`
Degree elevation: Returns a `CubicCurve` representation of this `QuadraticCurve`.
`QuadraticCurve`
`getTransformed(AffineTransform t)`
Default implementation returning a transformed `Path` representation of this `IGeometry`.
`final int`
`hashCode()`
`QuadraticCurve`
`setCtrl(Point ctrl)`
Sets the curve's control point.
`QuadraticCurve`
`setCtrlX(double ctrlX)`
Sets the x-coordinate of the curve's control point.
`QuadraticCurve`
`setCtrlY(double ctrlY)`
Sets the y-coordinate of the curve's control point.
`QuadraticCurve[]`
`split(double t)`
Splits this QuadraticCurve using the de Casteljau algorithm at parameter t into two separate QuadraticCurve objects.
`Path`
`toPath()`
Transform the QuadraticCurve object to a `Path` object with the same shape.
`String`
`toString()`
`boolean`
`touches(IGeometry g)`
Returns `true` if the input `IGeometry` touches this `IGeometry`, i.e. there is at least one common point.

### 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`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.gef.geometry.planar.IGeometry

`touches`

## Constructor Details

### QuadraticCurve

public QuadraticCurve(double... coordinates)
Constructs a new `QuadraticCurve` 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(double, double, double, double, double, double)`

### 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-coordinate
  `y1` - the start point's y-coordinate
  `ctrlX` - the control point's x-coordinate
  `ctrlY` - the control point's y-coordinate
  `x2` - the end point's x-coordinate
  `y2` - the end point's y-coordinate

### QuadraticCurve

public QuadraticCurve(Point... points)
Constructs a new `QuadraticCurve` from the given sequence of `Point`s formed by start-, control-, and end-point.

Parameters:
  `points` - the control `Point`s
See Also:
  - `QuadraticCurve(Point, Point, Point)`

### QuadraticCurve

public QuadraticCurve(Point p1, Point pCtrl, Point p2)
Constructs a new QuadraticCurve object from the given points.

Parameters:
  `p1` - the start point
  `pCtrl` - the control point
  `p2` - the end point

## Method Details

### getCopy

public QuadraticCurve getCopy()
Returns a new `QuadraticCurve`, which has the same start, end, and control point coordinates as this one.

Specified by:
  `getCopy` in interface `IGeometry`
Overrides:
  `getCopy` in class `BezierCurve`
Returns:
  a new `QuadraticCurve` with the same start, end, and control point coordinates

### getCtrl

public Point 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

public CubicCurve getElevated()
Degree elevation: Returns a `CubicCurve` representation of this `QuadraticCurve`.

Overrides:
  `getElevated` in class `BezierCurve`
Returns:
  A `CubicCurve` that represents this `QuadraticCurve`.

### getTransformed

public QuadraticCurve getTransformed(AffineTransform t)
Default implementation returning a transformed `Path` representation of this `IGeometry`. Subclasses may override this method to return a more specific representation.

Specified by:
  `getTransformed` in interface `IGeometry`
Overrides:
  `getTransformed` in class `BezierCurve`
Parameters:
  `t` - The `AffineTransform` to be applied
Returns:
  a transformed `Path` representation of this `IGeometry`
See Also:
  - `IGeometry.getTransformed(AffineTransform)`

### setCtrl

public QuadraticCurve setCtrl(Point ctrl)
Sets the curve's control point.

Parameters:
  `ctrl` - The new curve's control point.
Returns:
  `this` for convenience

### setCtrlX

public QuadraticCurve setCtrlX(double ctrlX)
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

public QuadraticCurve setCtrlY(double ctrlY)
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

public QuadraticCurve[] split(double t)
Splits this QuadraticCurve using the de Casteljau algorithm at parameter t into two separate QuadraticCurve objects. The returned `QuadraticCurve`s are the curves for [0, t] and [t, 1].

Overrides:
  `split` in class `BezierCurve`
Parameters:
  `t` - in range [0,1]
Returns:
  two QuadraticCurve objects constituting the original curve: 1. [0, t] 2. [t, 1]

### toPath

public Path toPath()
Transform the QuadraticCurve object to a `Path` object with the same shape.

Specified by:
  `toPath` in interface `IGeometry`
Overrides:
  `toPath` in class `BezierCurve`
Returns:
  a `Path` object representing the curve

### toString

public String toString()

Overrides:
  `toString` in class `BezierCurve`

### clone

public Object clone()
Overridden with public visibility as recommended within `Cloneable` .

Overrides:
  `clone` in class `Object`

### hashCode

public final int hashCode()

Overrides:
  `hashCode` in class `Object`
See Also:
  - `Object.hashCode()`

### touches

public boolean touches(IGeometry g)
Description copied from interface: `IGeometry`
Returns `true` if the input `IGeometry` touches this `IGeometry`, i.e. there is at least one common point.

Specified by:
  `touches` in interface `IGeometry`
Parameters:
  `g` - The `IGeometry` for the intersection test
Returns:
  `true` if the input `IGeometry` and this `IGeometry` have at least one common point.