public class Line extends BezierCurve
PrecisionUtils) to compensate for rounding effects.| Constructor and Description |
|---|
Line(double... coordinates)
Constructs a new
Line from the given coordinate values. |
Line(double x1,
double y1,
double x2,
double y2)
|
Line(Point... points)
|
Line(Point p1,
Point p2)
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Overridden with public visibility as recommended within
Cloneable
. |
boolean |
contains(Point p)
|
boolean |
equals(double x1,
double y1,
double x2,
double y2)
Tests whether this
Line is equal to the line given implicitly by
the given point coordinates. |
Point |
get(double t)
Computes the
Point on this BezierCurve at parameter value
t, which is expected to lie in the parameter Interval
[0;1]. |
Rectangle |
getBounds()
|
Line |
getCopy()
Returns a new
Line, which has the same start and end point
coordinates as this one. |
Angle |
getDirectionCCW()
Returns the counter-clockwise angle between the x axis and this
Line. |
Angle |
getDirectionCW()
Returns the clockwise angle between the x axis and this
Line. |
Point |
getIntersection(Line l)
Returns the single intersection point between this
Line and the
given one, in case it exists. |
protected java.util.Set<org.eclipse.gef4.geometry.planar.BezierCurve.IntervalPair> |
getIntersectionIntervalPairs(BezierCurve other,
java.util.Set<Point> intersections)
Computes
IntervalPairs which do reflect Points of
intersection between this and the given other BezierCurve. |
protected java.util.Set<org.eclipse.gef4.geometry.planar.BezierCurve.IntervalPair> |
getIntersectionIntervalPairs(Line other,
java.util.Set<Point> intersections)
Provides an optimized version of the
BezierCurve.getIntersectionIntervalPairs(BezierCurve, Set)
method. |
Point[] |
getIntersections(BezierCurve curve)
Returns the
Points of intersection of this and the given other
BezierCurve. |
double |
getLength()
|
Point[] |
getPoints()
|
Point |
getProjection(Point p)
|
Line |
getTransformed(AffineTransform t)
|
int |
hashCode() |
boolean |
intersects(ICurve c)
|
boolean |
intersects(Line l)
Provides an optimized version of the
BezierCurve.intersects(ICurve) method. |
boolean |
overlaps(BezierCurve c)
Checks if this
BezierCurve and the given other
BezierCurve overlap, i.e. an infinite set of intersection
Points exists. |
boolean |
overlaps(Line l)
|
Line |
setLine(double x1,
double y1,
double x2,
double y2)
Initializes this
Line with the given start and end point
coordinates |
Line |
setLine(Line l)
Initializes this
Line with the start and end point coordinates of
the given one. |
Line |
setLine(Point p1,
Point p2)
Initializes this
Line with the start and end point coordinates
provided by the given points |
Line |
setX1(double x1)
|
Line |
setX2(double x2)
|
Line |
setY1(double y1)
|
Line |
setY2(double y2)
|
Path |
toPath()
|
java.lang.String |
toString() |
boolean |
touches(IGeometry g)
|
boolean |
touches(Line l)
Tests whether this
Line and the given one share at least one
common point. |
contains, equals, getClipped, getControlBounds, getDerivative, getElevated, getIntersections, getOverlap, getOverlaps, getP1, getP2, getParameterAt, getPoint, getRotatedCCW, getRotatedCCW, getRotatedCCW, getRotatedCW, getRotatedCW, getRotatedCW, getScaled, getScaled, getScaled, getScaled, getScaled, getScaled, getTranslated, getTranslated, getX1, getX2, getY1, getY2, overlaps, rotateCCW, rotateCCW, rotateCCW, rotateCW, rotateCW, rotateCW, scale, scale, scale, scale, scale, scale, setP1, setP2, setPoint, split, toBezier, toCubic, toLine, toLineStrip, toLineStrip, toPoints, toQuadratic, translate, translatepublic Line(double... coordinates)
Line from the given coordinate values.coordinates - A varargs of 4 doubles, providing the x and y coordinates of
the start point, followed by those of the end pointBezierCurve.BezierCurve(double[])public Line(double x1,
double y1,
double x2,
double y2)
x1 - the x-coordinate of the start pointy1 - the y-coordinate of the start pointx2 - the x-coordinate of the end pointy2 - the y-coordinate of the end pointpublic Line(Point... points)
points - A varargs of two points serving as the start and end point of
this linepublic boolean equals(double x1,
double y1,
double x2,
double y2)
Line is equal to the line given implicitly by
the given point coordinates.x1 - the x-coordinate of the start point of the line to testy1 - the y-coordinate of the start point of the line to testx2 - the x-coordinate of the end point of the line to testy2 - the y-coordinate of the end point of the line to testtrue if the given start and end point coordinates
are (imprecisely) equal to this Line 's start and end
point coordinatespublic Point get(double t)
BezierCurvePoint on this BezierCurve at parameter value
t, which is expected to lie in the parameter Interval
[0;1].get in class BezierCurvet - the parameter value for which this BezierCurve is
evaluatedPoint on this BezierCurve at the given
parameter valuepublic Rectangle getBounds()
getBounds in interface IGeometrygetBounds in class BezierCurveRectangle object that fully encloses this
IGeometryIGeometry.getBounds()public Line getCopy()
Line, which has the same start and end point
coordinates as this one.getCopy in interface IGeometrygetCopy in class BezierCurveLine with the same start and end point coordinatespublic Angle getDirectionCCW()
Line.Line.public Angle getDirectionCW()
Line.Line.public Point getIntersection(Line l)
Line and the
given one, in case it exists. Note that even in case
intersects(org.eclipse.gef4.geometry.planar.ICurve) returns true, there may not be a single
intersection point in case both lines overlap in more than one point.l - the Line, for which to compute the intersection pointLine and the
given one, in case it intersects, null insteadprotected java.util.Set<org.eclipse.gef4.geometry.planar.BezierCurve.IntervalPair> getIntersectionIntervalPairs(BezierCurve other, java.util.Set<Point> intersections)
BezierCurve
Computes IntervalPairs which do reflect Points of
intersection between this and the given other BezierCurve. Each
IntervalPair reflects a single Point of intersection.
For every IntervalPair a Point of intersection is
inserted into the given Set of Points.
If there are infinite Points of intersection, i.e. the curves do
overlap, an empty set is returned. (see
BezierCurve.overlaps(BezierCurve))
getIntersectionIntervalPairs in class BezierCurveother - The BezierCurve which is searched for Points
of intersection with this BezierCurve.intersections - The Point-Set where Points of
intersection are inserted.Points, a Set
of IntervalPairs is returned where every
IntervalPair represents a single Point of
intersection. For an infinite number of intersection
Points, an empty Set is returned.protected java.util.Set<org.eclipse.gef4.geometry.planar.BezierCurve.IntervalPair> getIntersectionIntervalPairs(Line other, java.util.Set<Point> intersections)
BezierCurve.getIntersectionIntervalPairs(BezierCurve, Set)
method.other - The Line which is searched for points of intersections
with this BezierCurve.intersections - The Set where intersections are inserted.BezierCurve.getIntersectionIntervalPairs(BezierCurve, Set)public Point[] getIntersections(BezierCurve curve)
BezierCurvePoints of intersection of this and the given other
BezierCurve.getIntersections in class BezierCurvecurve - the BezierCurve which is searched for Points
of intersection with this BezierCurvePoints of intersection of this BezierCurve
and the given other BezierCurvepublic double getLength()
Point.getDistance(Point)public Point[] getPoints()
getPoints in class BezierCurvePoints, whose x and y coordinates match
those of this Line's start and end pointpublic Point getProjection(Point p)
ICurvePoint onto
this ICurve, i.e. a Point on this ICurve that is
closest to the given reference Point. Note, thatgetProjection in interface ICurvegetProjection in class BezierCurvep - The reference Point for which to return the
projection.Point onto
this ICurve.public Line getTransformed(AffineTransform t)
Path
representation of this IGeometry. Subclasses may override this
method to return a more specific representation.getTransformed in interface IGeometrygetTransformed in class BezierCurvet - The AffineTransform to be appliedPath representation of this
IGeometryIGeometry.getTransformed(AffineTransform)public boolean intersects(ICurve c)
ICurveICurve 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 ICurve.overlaps(ICurve)).intersects in interface ICurveintersects in class BezierCurvec - The ICurve to test for intersections.true if they intersect, false otherwisepublic boolean intersects(Line l)
BezierCurve.intersects(ICurve) method.l - The Line to test for intersections.BezierCurve.intersects(ICurve)public boolean overlaps(BezierCurve c)
BezierCurveBezierCurve and the given other
BezierCurve overlap, i.e. an infinite set of intersection
Points exists.overlaps in class BezierCurvec - the BezierCurve to check for an overlapping segment
with this BezierCurvetrue if this and the given other BezierCurve
overlap, otherwise falsepublic boolean overlaps(Line l)
Line and the given other Line overlap,
i.e. they share an infinite number of Points.l - the other Line to test for overlap with this
Linetrue if this Line and the other Line
overlap, otherwise falseICurve.overlaps(ICurve)public Line setLine(double x1, double y1, double x2, double y2)
Line with the given start and end point
coordinatesx1 - the x-coordinate of the start pointy1 - the y-coordinate of the start pointx2 - the x-coordinate of the end pointy2 - the y-coordinate of the end pointthis for conveniencepublic Line setLine(Line l)
Line with the start and end point coordinates of
the given one.l - the Line whose start and end point coordinates should
be used for initializationthis for conveniencepublic Line setLine(Point p1, Point p2)
Line with the start and end point coordinates
provided by the given pointspublic Line setX1(double x1)
public Line setX2(double x2)
public Line setY1(double y1)
public Line setY2(double y2)
public Path toPath()
BezierCurvetoPath in interface IGeometrytoPath in class BezierCurvePath approximating this BezierCurve using
Line segmentspublic java.lang.String toString()
toString in class BezierCurvepublic boolean touches(Line l)
Line and the given one share at least one
common point.public java.lang.Object clone()
Cloneable
.clone in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()Copyright (c) 2014 itemis AG, and others. All rights reserved.