java.awt.geom
public abstract class Line2D extends Object implements Shape, Cloneable
Since: 1.2
UNKNOWN: updated to 1.4
Nested Class Summary | |
---|---|
static class | Line2D.Double
This class defines a point in double precision.
|
static class | Line2D.Float
This class defines a point in float precision.
|
Constructor Summary | |
---|---|
protected | Line2D()
The default constructor. |
Method Summary | |
---|---|
Object | clone()
Create a new line of the same run-time type with the same contents as
this one.
|
boolean | contains(double x, double y)
Test if a point is contained inside the line. |
boolean | contains(Point2D p)
Test if a point is contained inside the line. |
boolean | contains(double x, double y, double w, double h)
Tests if the line contains a rectangle. |
boolean | contains(Rectangle2D r)
Tests if the line contains a rectangle. |
Rectangle | getBounds()
Gets a bounding box (not necessarily minimal) for this line.
|
abstract Point2D | getP1()
Return the first point.
|
abstract Point2D | getP2()
Return the second point.
|
PathIterator | getPathIterator(AffineTransform at)
Return a path iterator, possibly applying a transform on the result. |
PathIterator | getPathIterator(AffineTransform at, double flatness)
Return a flat path iterator, possibly applying a transform on the result.
|
abstract double | getX1()
Return the x coordinate of the first point.
|
abstract double | getX2()
Return the x coordinate of the second point.
|
abstract double | getY1()
Return the y coordinate of the first point.
|
abstract double | getY2()
Return the y coordinate of the second point.
|
boolean | intersects(double x, double y, double w, double h)
Tests if this line intersects the interior of the specified rectangle.
|
boolean | intersects(Rectangle2D r)
Tests if this line intersects the interior of the specified rectangle.
|
boolean | intersectsLine(double x1, double y1, double x2, double y2)
Test if this line intersects the line given by (x1,y1)->(x2,y2).
|
boolean | intersectsLine(Line2D l)
Test if this line intersects the given line.
|
static boolean | linesIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
Test if the line segment (x1,y1)->(x2,y2) intersects the line segment
(x3,y3)->(x4,y4).
|
static double | ptLineDist(double x1, double y1, double x2, double y2, double px, double py)
Measures the shortest distance from the reference point to a point on
the infinite line extended from the segment. |
double | ptLineDist(double px, double py)
Measures the shortest distance from the reference point to a point on
the infinite line extended from this segment. |
double | ptLineDist(Point2D p)
Measures the shortest distance from the reference point to a point on
the infinite line extended from this segment. |
static double | ptLineDistSq(double x1, double y1, double x2, double y2, double px, double py)
Measures the square of the shortest distance from the reference point
to a point on the infinite line extended from the segment. |
double | ptLineDistSq(double px, double py)
Measures the square of the shortest distance from the reference point
to a point on the infinite line extended from this segment. |
double | ptLineDistSq(Point2D p)
Measures the square of the shortest distance from the reference point
to a point on the infinite line extended from this segment. |
static double | ptSegDist(double x1, double y1, double x2, double y2, double px, double py)
Measures the shortest distance from the reference point to a point on
the line segment. |
double | ptSegDist(double px, double py)
Measures the shortest distance from the reference point to a point on
this line segment. |
double | ptSegDist(Point2D p)
Measures the shortest distance from the reference point to a point on
this line segment. |
static double | ptSegDistSq(double x1, double y1, double x2, double y2, double px, double py)
Measures the square of the shortest distance from the reference point
to a point on the line segment. |
double | ptSegDistSq(double px, double py)
Measures the square of the shortest distance from the reference point
to a point on this line segment. |
double | ptSegDistSq(Point2D p)
Measures the square of the shortest distance from the reference point
to a point on this line segment. |
static int | relativeCCW(double x1, double y1, double x2, double y2, double px, double py)
Computes the relative rotation direction needed to pivot the line about
the first point in order to have the second point colinear with point p.
|
int | relativeCCW(double px, double py)
Computes the relative rotation direction needed to pivot this line about
the first point in order to have the second point colinear with point p.
|
int | relativeCCW(Point2D p)
Computes the relative rotation direction needed to pivot this line about
the first point in order to have the second point colinear with point p.
|
abstract void | setLine(double x1, double y1, double x2, double y2)
Set the coordinates of the line to the given coordinates. |
void | setLine(Point2D p1, Point2D p2)
Set the coordinates to the given points.
|
void | setLine(Line2D l)
Set the coordinates to those of the given line.
|
Returns: the clone
Throws: OutOfMemoryError If there is not enough memory available.
Since: 1.2
Parameters: x the x coordinate y the y coordinate
Returns: false; the line does not contain points
Parameters: p the point
Returns: false; the line does not contain points
Parameters: x the x coordinate of the rectangle y the y coordinate of the rectangle w the width of the rectangle h the height of the rectangle
Returns: false; the line does not contain points
Parameters: r the rectangle
Returns: false; the line does not contain points
Returns: the integer bounding box
See Also: Line2D
Returns: the starting point
Returns: the ending point
Parameters: at the transform, or null
Returns: a new path iterator
Parameters: at the transform, or null flatness ignored, since lines are already flat
Returns: a new path iterator
See Also: getPathIterator
Returns: the starting x coordinate
Returns: the ending x coordinate
Returns: the starting y coordinate
Returns: the ending y coordinate
Parameters: x the x coordinate of the rectangle y the y coordinate of the rectangle w the width of the rectangle h the height of the rectangle
Returns: true if the line intersects the rectangle
Parameters: r the rectangle
Returns: true if the line intersects the rectangle
Throws: NullPointerException if r is null
Parameters: x1 the first x coordinate of the other segment y1 the first y coordinate of the other segment x2 the second x coordinate of the other segment y2 the second y coordinate of the other segment
Returns: true if the segments intersect
See Also: Line2D
Parameters: l the other segment
Returns: true if the segments intersect
Throws: NullPointerException if l is null
See Also: Line2D
Parameters: x1 the first x coordinate of the first segment y1 the first y coordinate of the first segment x2 the second x coordinate of the first segment y2 the second y coordinate of the first segment x3 the first x coordinate of the second segment y3 the first y coordinate of the second segment x4 the second x coordinate of the second segment y4 the second y coordinate of the second segment
Returns: true if the segments intersect
Parameters: x1 the first x coordinate of the segment y1 the first y coordinate of the segment x2 the second x coordinate of the segment y2 the second y coordinate of the segment px the x coordinate of the point py the y coordinate of the point
Returns: the distance from the point to the extended line
Parameters: px the x coordinate of the point py the y coordinate of the point
Returns: the distance from the point to the extended line
See Also: Line2D
Parameters: p the point
Returns: the distance from the point to the extended line
Throws: NullPointerException if p is null
See Also: Line2D
Parameters: x1 the first x coordinate of the segment y1 the first y coordinate of the segment x2 the second x coordinate of the segment y2 the second y coordinate of the segment px the x coordinate of the point py the y coordinate of the point
Returns: the square of the distance from the point to the extended line
Parameters: px the x coordinate of the point py the y coordinate of the point
Returns: the square of the distance from the point to the extended line
See Also: Line2D
Parameters: p the point
Returns: the square of the distance from the point to the extended line
Throws: NullPointerException if p is null
See Also: Line2D
Parameters: x1 the first x coordinate of the segment y1 the first y coordinate of the segment x2 the second x coordinate of the segment y2 the second y coordinate of the segment px the x coordinate of the point py the y coordinate of the point
Returns: the distance from the point to the segment
Parameters: px the x coordinate of the point py the y coordinate of the point
Returns: the distance from the point to the segment
See Also: Line2D
Parameters: p the point
Returns: the distance from the point to the segment
Throws: NullPointerException if p is null
See Also: Line2D
Parameters: x1 the first x coordinate of the segment y1 the first y coordinate of the segment x2 the second x coordinate of the segment y2 the second y coordinate of the segment px the x coordinate of the point py the y coordinate of the point
Returns: the square of the distance from the point to the segment
Parameters: px the x coordinate of the point py the y coordinate of the point
Returns: the square of the distance from the point to the segment
See Also: Line2D
Parameters: p the point
Returns: the square of the distance from the point to the segment
Throws: NullPointerException if p is null
See Also: Line2D
Parameters: x1 the first x coordinate y1 the first y coordinate x2 the second x coordinate y2 the second y coordinate px the reference x coordinate py the reference y coordinate
Returns: the relative rotation direction
Parameters: px the reference x coordinate py the reference y coordinate
Returns: the relative rotation direction
See Also: Line2D
Parameters: p the reference point
Returns: the relative rotation direction
Throws: NullPointerException if p is null
See Also: Line2D
Parameters: x1 the first x coordinate y1 the first y coordinate x2 the second x coordinate y2 the second y coordinate
Parameters: p1 the first point p2 the second point
Throws: NullPointerException if either point is null
Parameters: l the line to copy
Throws: NullPointerException if l is null