org.eclipse.gef.geometry.planar

## Class CubicCurve

- java.lang.Object
- - org.eclipse.gef.geometry.planar.BezierCurve
  - - org.eclipse.gef.geometry.planar.CubicCurve

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, ICurve, IGeometry, IRotatable<BezierCurve>, IScalable<BezierCurve>, ITranslatable<BezierCurve>

    public class CubicCurve
    extends BezierCurve

An instance of the `CubicCurve` class represents a `BezierCurve` of degree 3, having a start and an end `Point` and two handle `Point`s.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`CubicCurve(double... coordinates)` Constructs a new `CubicCurve` object with the given sequence of x and y coordinates of the start `Point`, the two handle `Point`s, and the end `Point`.
`CubicCurve(double x1, double y1, double ctrl1X, double ctrl1Y, double ctrl2X, double ctrl2Y, double x2, double y2)` Constructs a new `CubicCurve` object from the given control `Point` coordinates.
`CubicCurve(Point... points)` Constructs a new `CubicCurve` from the given sequence of `Point`s, which is expected to be in the order: start `Point` , first and second handle `Point`s, and end `Point`.
`CubicCurve(Point start, Point ctrl1, Point ctrl2, Point end)` Constructs a new `CubicCurve` object from the given control `Point`s.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.Object` `clone()` Overridden with public visibility as recommended within `Cloneable` .
`CubicCurve` `getCopy()` Returns a new `CubicCurve`, which has the same control `Point`s as this one.
`Point` `getCtrl1()` Returns the first handle `Point`.
`Point` `getCtrl2()` Returns the second handle `Point`.
`double` `getCtrlX1()` Returns the first handle `Point`'s x coordinate.
`double` `getCtrlX2()` Returns the second handle `Point`'s x coordinate.
`double` `getCtrlY1()` Returns the first handle `Point`'s y coordinate.
`double` `getCtrlY2()` Returns the second handle `Point`'s y coordinate.
`CubicCurve` `getTransformed(AffineTransform t)` Default implementation returning a transformed `Path` representation of this `IGeometry`.
`int` `hashCode()`
`CubicCurve` `setCtrl1(Point ctrl1)` Sets the first handle `Point` of this `CubicCurve` to the given `Point`.
`CubicCurve` `setCtrl1X(double ctrl1x)` Sets the x coordinate of the first handle `Point` of this `CubicCurve` to the given value.
`CubicCurve` `setCtrl1Y(double ctrl1y)` Sets the y coordinate of the first handle `Point` of this `CubicCurve` to the given value.
`CubicCurve` `setCtrl2(Point ctrl2)` Sets the second handle `Point` of this `CubicCurve` to the given `Point`.
`CubicCurve` `setCtrl2X(double ctrl2x)` Sets the x coordinate of the second handle `Point` of this `CubicCurve` to the given value.
`CubicCurve` `setCtrl2Y(double ctrl2y)` Sets the y coordinate of the second handle `Point` of this `CubicCurve` to the given value.
`CubicCurve` `setCurve(Point p1, Point ctrl1, Point ctrl2, Point p2)` Sets all control `Point`s of this `CubicCurve` to the given `Point`s.
`CubicCurve[]` `split(double t)` Subdivides this `BezierCurve` at the given parameter value t into two new `BezierCurve`s.
`Path` `toPath()` Returns a `Path` approximating this `BezierCurve` using `Line` segments.
`java.lang.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, getElevated, 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 Detail

#### CubicCurve

    public CubicCurve(double... coordinates)

Constructs a new `CubicCurve` object with the given sequence of x and y coordinates of the start `Point`, the two handle `Point`s, and the end `Point`.

Parameters:
  `coordinates` - the sequence of x and y coordinates specifying this `CubicCurve`'s control `Point`s
See Also:
  `CubicCurve(double, double, double, double, double, double, double, double)`

#### CubicCurve

    public CubicCurve(double x1,
                      double y1,
                      double ctrl1X,
                      double ctrl1Y,
                      double ctrl2X,
                      double ctrl2Y,
                      double x2,
                      double y2)

Constructs a new `CubicCurve` object from the given control `Point` coordinates.

Parameters:
  `x1` - the x coordinate of the start `Point`
  `y1` - the y coordinate of the start `Point`
  `ctrl1X` - the x coordinate of the first handle `Point`
  `ctrl1Y` - the y coordinate of the first handle `Point`
  `ctrl2X` - the x coordinate of the second handle `Point`
  `ctrl2Y` - the y coordinate of the second handle `Point`
  `x2` - the x coordinate of the end `Point`
  `y2` - the y coordinate of the end `Point`

#### CubicCurve

    public CubicCurve(Point... points)

Constructs a new `CubicCurve` from the given sequence of `Point`s, which is expected to be in the order: start `Point` , first and second handle `Point`s, and end `Point`.

Parameters:
  `points` - the sequence of `Point`s from which this `CubicCurve` is constructed
See Also:
  `CubicCurve(Point, Point, Point, Point)`, `CubicCurve(double, double, double, double, double, double, double, double)`

#### CubicCurve

    public CubicCurve(Point start,
                      Point ctrl1,
                      Point ctrl2,
                      Point end)

Constructs a new `CubicCurve` object from the given control `Point`s.

Parameters:
  `start` - the start `Point`
  `ctrl1` - the first handle `Point`
  `ctrl2` - the second handle `Point`
  `end` - the end `Point`
See Also:
  `CubicCurve(double, double, double, double, double, double, double, double)`

### Method Detail

#### getCopy

    public CubicCurve getCopy()

Returns a new `CubicCurve`, which has the same control `Point`s as this one.

Specified by:
  `getCopy` in interface `IGeometry`
Overrides:
  `getCopy` in class `BezierCurve`
Returns:
  a new `CubicCurve` with the same control `Point`s as this one

#### getCtrl1

    public Point getCtrl1()

Returns the first handle `Point`.

Returns:
  the first handle `Point`

#### getCtrl2

    public Point getCtrl2()

Returns the second handle `Point`.

Returns:
  the second handle `Point`

#### getCtrlX1

    public double getCtrlX1()

Returns the first handle `Point`'s x coordinate.

Returns:
  the first handle `Point`'s x coordinate

#### getCtrlX2

    public double getCtrlX2()

Returns the second handle `Point`'s x coordinate.

Returns:
  the second handle `Point`'s x coordinate

#### getCtrlY1

    public double getCtrlY1()

Returns the first handle `Point`'s y coordinate.

Returns:
  the first handle `Point`'s y coordinate

#### getCtrlY2

    public double getCtrlY2()

Returns the second handle `Point`'s y coordinate.

Returns:
  the second handle `Point`'s y coordinate

#### getTransformed

    public CubicCurve 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)`

#### setCtrl1

    public CubicCurve setCtrl1(Point ctrl1)

Sets the first handle `Point` of this `CubicCurve` to the given `Point`.

Parameters:
  `ctrl1` - the new first handle `Point`
Returns:
  `this` for convenience

#### setCtrl1X

    public CubicCurve setCtrl1X(double ctrl1x)

Sets the x coordinate of the first handle `Point` of this `CubicCurve` to the given value.

Parameters:
  `ctrl1x` - the new x coordinate of the first handle `Point` of this `CubicCurve`
Returns:
  `this` for convenience

#### setCtrl1Y

    public CubicCurve setCtrl1Y(double ctrl1y)

Sets the y coordinate of the first handle `Point` of this `CubicCurve` to the given value.

Parameters:
  `ctrl1y` - the new y coordinate of the first handle `Point` of this `CubicCurve`
Returns:
  `this` for convenience

#### setCtrl2

    public CubicCurve setCtrl2(Point ctrl2)

Sets the second handle `Point` of this `CubicCurve` to the given `Point`.

Parameters:
  `ctrl2` - the new second handle `Point` of this `CubicCurve`
Returns:
  `this` for convenience

#### setCtrl2X

    public CubicCurve setCtrl2X(double ctrl2x)

Sets the x coordinate of the second handle `Point` of this `CubicCurve` to the given value.

Parameters:
  `ctrl2x` - the new x coordinate of the second handle `Point` of this `CubicCurve`
Returns:
  `this` for convenience

#### setCtrl2Y

    public CubicCurve setCtrl2Y(double ctrl2y)

Sets the y coordinate of the second handle `Point` of this `CubicCurve` to the given value.

Parameters:
  `ctrl2y` - the new y coordinate of the second handle `Point` of this `CubicCurve`
Returns:
  `this` for convenience

#### setCurve

    public CubicCurve setCurve(Point p1,
                               Point ctrl1,
                               Point ctrl2,
                               Point p2)

Sets all control `Point`s of this `CubicCurve` to the given `Point`s.

Parameters:
  `p1` - the new start `Point`
  `ctrl1` - the new first control `Point`
  `ctrl2` - the new second control `Point`
  `p2` - the new end `Point`
Returns:
  `this` for convenience

#### split

    public CubicCurve[] split(double t)

Description copied from class: `BezierCurve`
Subdivides this `BezierCurve` at the given parameter value t into two new `BezierCurve`s. The first one is the `BezierCurve` over the parameter `Interval` `[0;t]` and the second one is the `BezierCurve` over the parameter `Interval` `[t;1]`.

Overrides:
  `split` in class `BezierCurve`
Parameters:
  `t` - the parameter value at which this `BezierCurve` is subdivided
Returns:
  an array of two `BezierCurve`s, the left ( `[0;t]`) and the right (`[t;1]`)

#### toPath

    public Path toPath()

Description copied from class: `BezierCurve`
Returns a `Path` approximating this `BezierCurve` using `Line` segments.

Specified by:
  `toPath` in interface `IGeometry`
Overrides:
  `toPath` in class `BezierCurve`
Returns:
  a `Path` approximating this `BezierCurve` using `Line` segments

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `BezierCurve`

#### clone

    public java.lang.Object clone()

Overridden with public visibility as recommended within `Cloneable` .

Overrides:
  `clone` in class `java.lang.Object`

#### hashCode

    public final int hashCode()

Overrides:
  `hashCode` in class `java.lang.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.