is new. 
 java.lang.Objectjava.awt.geom.Line2D
public abstract class Line2D
This Line2D represents a line segment in 
(x,y) 
(x, y) 
coordinate space.  This class, like all of the Java 2D API, uses a default coordinate system called 
user space
 in which the y-axis values increase downward and x-axis values increase to the right.  For more information on the user space coordinate system, see the  
 Coordinate Systems
 section of the Java 2D Programmer's Guide.   
This class is only the abstract superclass for all objects that store a 2D line segment. The actual storage representation of the coordinates is left to the subclass.
Since: 
1.2 
| Nested Class Summary | |
|---|---|
| static class | 
Line2D.Double
 A line segment specified with double coordinates.  | 
| static class | 
Line2D.Float
 A line segment specified with float coordinates.  | 
| Constructor Summary | |
|---|---|
| protected | 
Line2D
() This is an abstract class that cannot be instantiated directly.  | 
| Method Summary | |
|---|---|
| Object | 
clone
() Creates a new object of the same class as this object.  | 
| boolean | 
contains
(double x,         double y) Tests if a specified coordinate is inside the boundary of this Line2D.  | 
| boolean | 
contains
(double x,         double y,         double w,         double h) Tests if the interior of this Line2D entirely contains the specified set of rectangular coordinates.  | 
| boolean | 
contains
(
Point2D
 p) Tests if a given Point2D is inside the boundary of this Line2D.  | 
| boolean | 
contains
(
Rectangle2D
 r) Tests if the interior of this Line2D entirely contains the specified Rectangle2D.  | 
| Rectangle | 
getBounds
()  Returns  
an integer 
 
Rectangle
 
 | 
| abstract Point2D | 
getP1
()  Returns the  
start 
 
 | 
| abstract Point2D | 
getP2
() Returns the end Point2D of this Line2D.  | 
| PathIterator | 
getPathIterator
(
AffineTransform
 at) Returns an iteration object that defines the boundary of this Line2D.  | 
| PathIterator | 
getPathIterator
(
AffineTransform
 at,                double flatness) Returns an iteration object that defines the boundary of this flattened Line2D.  | 
| abstract double | 
getX1
() Returns the X coordinate of the start point in double precision.  | 
| abstract double | 
getX2
() Returns the X coordinate of the end point in double precision.  | 
| abstract double | 
getY1
() Returns the Y coordinate of the start point in double precision.  | 
| abstract double | 
getY2
() Returns the Y coordinate of the end point in double precision.  | 
| boolean | 
intersects
(double x, double y, double w, double h)  Tests if  
the interior of the Shape 
 
 
 
area. 
 
 | 
| boolean | 
intersects
( 
Rectangle2D
 Tests if  
the interior of the Shape 
 
 | 
| boolean | 
intersectsLine
 
(double x1, double y1, double x2, double y2) 
 
Tests if the line segment from  
(x1,y1) 
 
 
(x2,y2) 
 
 | 
| boolean | 
intersectsLine
(
Line2D
 l) Tests if the specified line segment intersects this line segment.  | 
| static boolean | 
linesIntersect
 
(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) 
 
Tests if the line segment from  
(x1,y1) 
 
 
(x2,y2) 
 
 
(x3,y3) 
 
 
(x4,y4). 
 
 | 
| double | 
ptLineDist
 
(double px, double py) 
 
Returns the distance from a point to this line.  | 
| static double | 
ptLineDist
 
(double x1, double y1, double x2, double y2, double px, double py) 
 
Returns the distance from a point to a line.  | 
| double | 
ptLineDist
(
Point2D
 pt) Returns the distance from a Point2D to this line.  | 
| double | 
ptLineDistSq
 
(double px, double py) 
 
Returns the square of the distance from a point to this line.  | 
| static double | 
ptLineDistSq
 
(double x1, double y1, double x2, double y2, double px, double py) 
 
Returns the square of the distance from a point to a line.  | 
| double | 
ptLineDistSq
(
Point2D
 pt) Returns the square of the distance from a specified Point2D to this line.  | 
| double | 
ptSegDist
 
(double px, double py) 
 
Returns the distance from a point to this line segment.  | 
| static double | 
ptSegDist
 
(double x1, double y1, double x2, double y2, double px, double py) 
 
Returns the distance from a point to a line segment.  | 
| double | 
ptSegDist
(
Point2D
 pt) Returns the distance from a Point2D to this line segment.  | 
| double | 
ptSegDistSq
 
(double px, double py) 
 
Returns the square of the distance from a point to this line segment.  | 
| static double | 
ptSegDistSq
 
(double x1, double y1, double x2, double y2, double px, double py) 
 
Returns the square of the distance from a point to a line segment.  | 
| double | 
ptSegDistSq
(
Point2D
 pt) Returns the square of the distance from a Point2D to this line segment.  | 
| int | 
relativeCCW
 
(double px, double py) 
 
Returns an indicator of where the specified point  
(px,py) 
 
 | 
| static int | 
relativeCCW
 
(double x1, double y1, double x2, double y2, double px, double py) 
 
Returns an indicator of where the specified point  
(px,py) 
 
 
(x1,y1) 
 
 
(x2,y2). 
 
 | 
| int | 
relativeCCW
(
Point2D
 p) Returns an indicator of where the specified Point2D lies with respect to this line segment.  | 
| abstract void | 
setLine
 
(double x1, double y1, double x2, double y2) 
 
Sets the location of the  
end points 
 
 | 
| void | 
setLine
( 
Line2D
 Sets the location of the  
end points 
 
 
end points 
 
 | 
| void | 
setLine
( 
Point2D
 p1, 
Point2D
 Sets the location of the  
end points 
 
 | 
| Methods inherited from class java.lang. Object | 
|---|
| equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait | 
| Methods inherited from interface java.awt. Shape | 
|---|
| getBounds2D | 
| Constructor Detail | 
|---|
protected Line2D()
Since: 
1.2 
| Method Detail | 
|---|
public abstract double getX1()
the X coordinate of the start point of this Line2D object. 
Since: 
1.2 
public abstract double getY1()
the Y coordinate of the start point of this Line2D object. 
Since: 
1.2 
public abstract Point2D getP1()
start 
start 
Since: 
1.2 
public abstract double getX2()
the X coordinate of the end point of this Line2D object. 
Since: 
1.2 
public abstract double getY2()
the Y coordinate of the end point of this Line2D object. 
Since: 
1.2 
public abstract Point2D getP2()
the end Point2D of this Line2D. 
Since: 
1.2 
public abstract void setLine(double x1, double y1, double x2, double y2)
(double X1, double Y1, double X2, double Y2)
end points 
x1 - the X coordinate of the start point 
y1 - the Y coordinate of the start point 
x2 - the X coordinate of the end point 
y2 - the Y coordinate of the end point 
Since: 
1.2 
public void setLine(Point2D p1,
                    Point2D p2)
end points 
p1 - the start Point2D of the line segment 
p2 - the end Point2D of the line segment 
Since: 
1.2 
public void setLine(Line2D l)
end points 
end points 
Since: 
1.2 
public static int relativeCCW(double x1, double y1, double x2, double y2, double px, double py)
(double X1, double Y1, double X2, double Y2, double PX, double PY)
(px,py) 
(x1,y1) 
(x2,y2). 
end point, (x1,y1), 
(px,py). 
A return value of 1 indicates that the line segment must turn in the direction that takes the positive X axis towards the negative Y axis. In the default coordinate system used by Java 2D, this direction is counterclockwise.
A return value of -1 indicates that the line segment must turn in the direction that takes the positive X axis towards the positive Y axis. In the default coordinate system, this direction is clockwise.
A return value of 0 indicates that the point lies exactly on the line segment. Note that an indicator value of 0 is rare and not useful for determining colinearity because of floating point rounding issues.
If the point is colinear with the line segment, but not between the 
end points, 
endpoints, 
then the value will be -1 if the point lies "beyond 
(x1,y1)" 
(X1, Y1)" 
or 1 if the point lies "beyond 
(x2,y2)". 
(X2, Y2)". 
x1 
X coordinate 
start point 
y1 
Y coordinate 
start point 
x2 - the X coordinate of the end point of the specified line segment 
y2 - the Y coordinate of the end point of the specified line segment 
px - the X coordinate of the specified point to be compared with the specified line segment 
py - the Y coordinate of the specified point to be compared with the specified line segment 
Since: 
1.2 
public int relativeCCW(double px, double py)
(double PX, double PY)
(px,py) 
px - the X coordinate of the specified point to be compared with this Line2D 
py - the Y coordinate of the specified point to be compared with this Line2D 
this Line2D 
Since: 
1.2 
public int relativeCCW(Point2D p)
this Line2D 
specified 
Point2D with respect to 
this Line2D 
Since: 
1.2 
public static boolean linesIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
(double X1, double Y1, double X2, double Y2, double X3, double Y3, double X4, double Y4)
(x1,y1) 
(x2,y2) 
(x3,y3) 
(x4,y4). 
x1 
X coordinate 
start point 
y1 
Y coordinate 
start point 
x2 
X coordinate 
end point 
first 
y2 - the Y coordinate of the end point of the first specified line segment 
x3 - the X coordinate of the start point of the second specified line segment 
y3 - the Y coordinate of the start point of the second specified line segment 
x4 - the X coordinate of the end point of the second specified line segment 
y4 - the Y coordinate of the end point of the second specified line segment 
Since: 
1.2 
public boolean intersectsLine(double x1, double y1, double x2, double y2)
(double X1, double Y1, double X2, double Y2)
(x1,y1) 
(x2,y2) 
x1 
X coordinate 
start point 
y1 - the Y coordinate of the start point of the specified line segment 
x2 - the X coordinate of the end point of the specified line segment 
y2 - the Y coordinate of the end point of the specified line segment 
Since: 
1.2 
public boolean intersectsLine(Line2D l)
Since: 
1.2 
public static double ptSegDistSq(double x1, double y1, double x2, double y2, double px, double py)
(double X1, double Y1, double X2, double Y2, double PX, double PY)
end points. 
end points, 
x1 
X coordinate 
start point 
y1 
Y coordinate 
start point 
x2 - the X coordinate of the end point of the specified line segment 
y2 - the Y coordinate of the end point of the specified line segment 
px - the X coordinate of the specified point being measured against the specified line segment 
py - the Y coordinate of the specified point being measured against the specified line segment 
Since: 
1.2 
public static double ptSegDist(double x1, double y1, double x2, double y2, double px, double py)
(double X1, double Y1, double X2, double Y2, double PX, double PY)
end points. 
end points, 
x1 
X coordinate 
start point 
y1 
Y coordinate 
start point 
x2 - the X coordinate of the end point of the specified line segment 
y2 - the Y coordinate of the end point of the specified line segment 
px - the X coordinate of the specified point being measured against the specified line segment 
py - the Y coordinate of the specified point being measured against the specified line segment 
Since: 
1.2 
public double ptSegDistSq(double px, double py)
(double PX, double PY)
end points. 
end points, 
px 
X coordinate 
py - the Y coordinate of the specified point being measured against this line segment 
Since: 
1.2 
public double ptSegDistSq(Point2D pt)
end points. 
end points, 
Since: 
1.2 
public double ptSegDist(double px, double py)
(double PX, double PY)
end points. 
end points, 
px 
X coordinate 
py - the Y coordinate of the specified point being measured against this line segment 
Since: 
1.2 
public double ptSegDist(Point2D pt)
end points. 
end points, 
Since: 
1.2 
public static double ptLineDistSq(double x1, double y1, double x2, double y2, double px, double py)
(double X1, double Y1, double X2, double Y2, double PX, double PY)
x1 
X coordinate 
the start 
of 
y1 
Y coordinate 
the start 
of 
x2 - the X coordinate of the end point of the specified line 
y2 - the Y coordinate of the end point of the specified line 
px - the X coordinate of the specified point being measured against the specified line 
py - the Y coordinate of the specified point being measured against the specified line 
Since: 
1.2 
public static double ptLineDist(double x1, double y1, double x2, double y2, double px, double py)
(double X1, double Y1, double X2, double Y2, double PX, double PY)
x1 
X coordinate 
the start 
of 
y1 
Y coordinate 
the start 
of 
x2 - the X coordinate of the end point of the specified line 
y2 - the Y coordinate of the end point of the specified line 
px - the X coordinate of the specified point being measured against the specified line 
py - the Y coordinate of the specified point being measured against the specified line 
Since: 
1.2 
public double ptLineDistSq(double px, double py)
(double PX, double PY)
px 
X coordinate 
py - the Y coordinate of the specified point being measured against this line 
Since: 
1.2 
public double ptLineDistSq(Point2D pt)
Since: 
1.2 
public double ptLineDist(double px, double py)
(double PX, double PY)
px 
X coordinate 
py - the Y coordinate of the specified point being measured against this line 
Since: 
1.2 
public double ptLineDist(Point2D pt)
Since: 
1.2 
public boolean contains(double x,
                        double y)
x - the X coordinate of the specified point to be tested 
y - the Y coordinate of the specified point to be tested 
Since: 
1.2 
public boolean contains(Point2D p)
Shape
Since: 
1.2 
public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Tests if the interior of the Shape intersects the interior of a specified rectangular area. The rectangular area is considered to intersect the Shape if any point is contained in both the interior of the Shape and the specified rectangular area. 
The Shape.intersects() method allows a Shape implementation to conservatively return true when: 
there is a high probability that the rectangular area and the Shape intersect, but 
the calculations to accurately determine this intersection are prohibitively expensive. 
This means that for some Shapes this method might return true even though the rectangular area does not intersect the Shape. The 
Area
class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required. 
x 
X coordinate 
upper-left 
y - the Y coordinate of the upper-left corner of the specified rectangular area 
true if the interior of the Shape and the interior of the rectangular area intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise. 
Since: 
1.2 
public boolean intersects(Rectangle2D r)
Tests if the interior of the Shape intersects the interior of a specified Rectangle2D. The Shape.intersects() method allows a Shape implementation to conservatively return true when: 
there is a high probability that the Rectangle2D and the Shape intersect, but 
the calculations to accurately determine this intersection are prohibitively expensive. 
This means that for some Shapes this method might return true even though the Rectangle2D does not intersect the Shape. The 
Area
class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required. 
true if the interior of the Shape and the interior of the specified Rectangle2D intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise. 
Since: 
1.2 
public boolean contains(double x,
                        double y,
                        double w,
                        double h)
x 
X coordinate 
upper-left 
y - the Y coordinate of the upper-left corner of the specified rectangular area 
Since: 
1.2 
public boolean contains(Rectangle2D r)
Since: 
1.2 
public Rectangle getBounds()
Returns an integer 
Rectangle
that completely encloses the Shape. Note that there is no guarantee that the returned Rectangle is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated Rectangle. The returned Rectangle might also fail to completely enclose the Shape if the Shape overflows the limited range of the integer data type. The getBounds2D method generally returns a tighter bounding box due to its greater flexibility in representation. 
an integer Rectangle that completely encloses the Shape. 
Since: 
1.2 
public PathIterator getPathIterator(AffineTransform at)
Since: 
1.2 
public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
end points. 
Since: 
1.2 
public Object clone()