public class IlpLineSegment extends Line2D implements Cloneable
Line2D.Double, Line2D.Float
Constructor and Description |
---|
IlpLineSegment(IlvPoint from,
IlvPoint to)
Creates a new line segment, connecting two points.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a copy of this object.
|
Rectangle2D |
getBounds2D()
Returns the smallest rectangle covering all points.
|
int |
getDirection()
Returns the direction of this line segment.
|
IlvPoint |
getFrom()
Returns the starting point of this segment.
|
int |
getOrientation()
Returns the orientation of this line segment.
|
Point2D |
getP1()
Returns the starting point.
|
Point2D |
getP2()
Returns the end point.
|
IlvPoint |
getTo()
Returns the end point of this segment.
|
double |
getX1()
Returns the X coordinate of the starting point.
|
double |
getX2()
Returns the X coordinate of the end point.
|
double |
getY1()
Returns the Y coordinate of the starting point.
|
double |
getY2()
Returns the Y coordinate of the end point.
|
boolean |
intersects(double x1,
double y1,
double x2,
double y2)
Tests whether this segment intersects a given rectangle
x1 <= x <= x2, y1 <= y <= y2.
|
boolean |
intersects(float x1,
float y1,
float x2,
float y2)
Deprecated.
since 9.0, use
intersects(double, double, double, double) |
boolean |
isParallelTo(IlpLineSegment other)
Tests whether this line segment is parallel to another line segment
(same orientation).
|
boolean |
isParallelVectorTo(IlpLineSegment other)
Tests whether this line segment is parallel to another line segment
including the same direction.
|
double |
length()
Returns the Euclidean length of this segment.
|
IlvPoint |
nearestTo(IlvPoint p)
Returns the point in this segment which is closest to a given point.
|
protected void |
setFrom(IlvPoint p)
Sets the starting point of this segment.
|
void |
setLine(double x1,
double y1,
double x2,
double y2)
Constructs and initializes a line from the specified coordinates.
|
protected void |
setTo(IlvPoint p)
Sets the end point of this segment.
|
double |
sqdist(IlvPoint p)
Returns the square of the distance of a given point to this segment.
|
String |
toString()
Converts the object into a human-readable format.
|
protected void |
transientInit()
Initialize transient fields.
|
contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine
protected void transientInit()
public IlvPoint getFrom()
protected void setFrom(IlvPoint p)
p
- Starting pointpublic IlvPoint getTo()
protected void setTo(IlvPoint p)
p
- End pointpublic int getOrientation()
0
, or IlvDirection.Horizontal
or IlvDirection.Vertical
, or (for an empty segment)
the combination of IlvDirection.Horizontal
and
IlvDirection.Vertical
.public int getDirection()
IlvDirection.Right
,
IlvDirection.Left
, IlvDirection.Bottom
,
IlvDirection.Top
, or (for an empty segment)
the combination of IlvDirection.Horizontal
and
IlvDirection.Vertical
.public double length()
public IlvPoint nearestTo(IlvPoint p)
public double sqdist(IlvPoint p)
@Deprecated public boolean intersects(float x1, float y1, float x2, float y2)
intersects(double, double, double, double)
public boolean intersects(double x1, double y1, double x2, double y2)
intersects
in interface Shape
intersects
in class Line2D
public boolean isParallelTo(IlpLineSegment other)
public boolean isParallelVectorTo(IlpLineSegment other)
public double getX1()
public double getY1()
public double getX2()
public double getY2()
public void setLine(double x1, double y1, double x2, double y2)
public Rectangle2D getBounds2D()
getBounds2D
in interface Shape
IlvRect
object.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.