org.eclipse.gef.geometry.planar

## Interface ICurve

All Superinterfaces:
  java.lang.Cloneable, IGeometry, java.io.Serializable

All Known Implementing Classes:
  Arc, BezierCurve, CubicCurve, Line, PolyBezier, Polyline, QuadraticCurve

    public interface ICurve
    extends IGeometry

The `ICurve` interface provides operations that allow the analysis of linear geometric objects and the transfer to `BezierCurve` segments ( `toBezier()`). The start and end `Point` of an `ICurve` can be retrieved using its `getP1()` and `getP2()` methods. Furthermore, you can search for `Point`s of intersection using the `getIntersections(ICurve)` method. If you do only need to know if there are any intersections, and you are not interested in their exact locations, then you can use the `intersects(ICurve)` method, instead. To test for an overlap, i.e. an identical segment of two `ICurve`s, use the `overlaps(ICurve)` method. One may think that an overlap is a very rare case. But in practical application, objects are usually aligned to a grid, which extremely increases the probability of an overlap.

### Method Summary

All Methods Instance Methods Abstract Methods
`Point[]` `getIntersections(ICurve c)` Returns the points of intersection between this `ICurve` and the given `ICurve`.
`ICurve[]` `getOverlaps(ICurve c)` Returns the curve segments at which this `ICurve` and the given `ICurve` overlap.
`Point` `getP1()` Returns a `Point` representing the start point of this `ICurve`.
`Point` `getP2()` Returns a `Point` representing the end point of this `ICurve` .
`Point` `getProjection(Point reference)` Returns a projection of the given reference `Point` onto this `ICurve`, i.e. a `Point` on this `ICurve` that is closest to the given reference `Point`.
`double` `getX1()` Returns the start `Point`'s x coordinate.
`double` `getX2()` Returns the end `Point`'s x coordinate.
`double` `getY1()` Returns the start `Point`'s y coordinate.
`double` `getY2()` Returns the end `Point`'s y coordinate.
`boolean` `intersects(ICurve c)` Tests if this `ICurve` and the given `ICurve` intersect, i.e.
`boolean` `overlaps(ICurve c)` Tests if this `ICurve` and the given `ICurve` overlap, i.e.
`BezierCurve[]` `toBezier()` Computes a list of `BezierCurve`s that approximate the `ICurve`.

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

`contains, getBounds, getCopy, getTransformed, toPath, touches`

### Method Detail

#### getIntersections

    Point[] getIntersections(ICurve c)

Returns the points of intersection between this `ICurve` and the given `ICurve`.

Parameters:
  `c` - The `ICurve` to compute intersection points with.
Returns:
  The points of intersection.

#### getOverlaps

    ICurve[] getOverlaps(ICurve c)

Returns the curve segments at which this `ICurve` and the given `ICurve` overlap.

Parameters:
  `c` - The curve to compute overlaps with.
Returns:
  The segments where both curves overlap.

#### getP1

    Point getP1()

Returns a `Point` representing the start point of this `ICurve`.

Returns:
  a new `Point` with the coordinates of the `ICurve`'s start point.

#### getP2

    Point getP2()

Returns a `Point` representing the end point of this `ICurve` .

Returns:
  a new `Point` with the coordinates of the `ICurve`'s end point.

#### getProjection

    Point getProjection(Point reference)

Returns a projection of the given reference `Point` onto this `ICurve`, i.e. a `Point` on this `ICurve` that is closest to the given reference `Point`. Note, that

Parameters:
  `reference` - The reference `Point` for which to return the projection.
Returns:
  The projection of the given reference `Point` onto this `ICurve`.

#### getX1

    double getX1()

Returns the start `Point`'s x coordinate.

Returns:
  the start `Point`'s x coordinate

#### getX2

    double getX2()

Returns the end `Point`'s x coordinate.

Returns:
  the end `Point`'s x coordinate

#### getY1

    double getY1()

Returns the start `Point`'s y coordinate.

Returns:
  the start `Point`'s y coordinate

#### getY2

    double getY2()

Returns the end `Point`'s y coordinate.

Returns:
  the end `Point`'s y coordinate

#### intersects

    boolean intersects(ICurve c)

Tests if this `ICurve` and the given `ICurve` intersect, i.e. whether a final set of intersection points exists. Two curves intersect if they touch (see `IGeometry.touches(IGeometry)`) but do not overlap (see `overlaps(ICurve)`).

Parameters:
  `c` - The `ICurve` to test for intersections.
Returns:
  `true` if they intersect, `false` otherwise

#### overlaps

    boolean overlaps(ICurve c)

Tests if this `ICurve` and the given `ICurve` overlap, i.e. whether an infinite set of intersection points exists. Two curves overlap if they touch (see `IGeometry.touches(IGeometry)`) but not intersect (see `intersects(ICurve)`).

Parameters:
  `c` - The `ICurve` to test for overlap.
Returns:
  `true` if they overlap, `false` otherwise

#### toBezier

    BezierCurve[] toBezier()

Computes a list of `BezierCurve`s that approximate the `ICurve`. For example, a `Line` or a `BezierCurve` in general could return a list with the curve itself as its only element. But an `Ellipse` or an `Arc` may return a list of consecutive `BezierCurve`s which approximate the `ICurve`.

Returns:
  a list of `BezierCurve`s that approximate the `ICurve`