public interface ICurve extends IGeometry
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.Modifier and Type | Method and Description |
---|---|
Point[] |
getIntersections(ICurve c)
|
ICurve[] |
getOverlaps(ICurve c)
|
Point |
getP1()
|
Point |
getP2()
|
Point |
getProjection(Point reference)
|
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)
|
boolean |
overlaps(ICurve c)
|
BezierCurve[] |
toBezier()
Computes a list of
BezierCurve s that approximate the
ICurve . |
Point[] getIntersections(ICurve c)
c
- The ICurve
to compute intersection points with.ICurve[] getOverlaps(ICurve c)
c
- The curve to compute overlaps with.double getX1()
Point
's x coordinate.Point
's x coordinatedouble getY1()
Point
's y coordinate.Point
's y coordinateboolean intersects(ICurve c)
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)
).c
- The ICurve
to test for intersections.true
if they intersect, false
otherwiseboolean overlaps(ICurve c)
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)
).c
- The ICurve
to test for overlap.true
if they overlap, false
otherwiseBezierCurve[] toBezier()
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
.BezierCurve
s that approximate the
ICurve
Copyright (c) 2014 itemis AG, and others. All rights reserved.