java.awt.geom
Class Line2D

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.geom.Line2D
All Implemented Interfaces:
Shape sample code for java.awt.Shape definition code for java.awt.Shape , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable
Direct Known Subclasses:
Line2D.Double sample code for java.awt.geom.Line2D.Double definition code for java.awt.geom.Line2D.Double , Line2D.Float sample code for java.awt.geom.Line2D.Float definition code for java.awt.geom.Line2D.Float

public abstract class Line2D
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Shape sample code for java.awt.Shape definition code for java.awt.Shape , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

This Line2D represents a line segment in (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.


Nested Class Summary
static class Line2D.Double sample code for java.awt.geom.Line2D.Double definition code for java.awt.geom.Line2D.Double
          A line segment specified with double coordinates.
static class Line2D.Float sample code for java.awt.geom.Line2D.Float definition code for java.awt.geom.Line2D.Float
          A line segment specified with float coordinates.
 
Constructor Summary
protected Line2D sample code for java.awt.geom.Line2D.Line2D() definition code for java.awt.geom.Line2D.Line2D() ()
          This is an abstract class that cannot be instantiated directly.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for java.awt.geom.Line2D.clone() definition code for java.awt.geom.Line2D.clone() ()
          Creates a new object of the same class as this object.
 boolean contains sample code for java.awt.geom.Line2D.contains(double, double) definition code for java.awt.geom.Line2D.contains(double, double) (double x, double y)
          Tests if a specified coordinate is inside the boundary of this Line2D.
 boolean contains sample code for java.awt.geom.Line2D.contains(double, double, double, double) definition code for java.awt.geom.Line2D.contains(double, double, double, double) (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 sample code for java.awt.geom.Line2D.contains(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.contains(java.awt.geom.Point2D) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p)
          Tests if a given Point2D is inside the boundary of this Line2D.
 boolean contains sample code for java.awt.geom.Line2D.contains(java.awt.geom.Rectangle2D) definition code for java.awt.geom.Line2D.contains(java.awt.geom.Rectangle2D) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
          Tests if the interior of this Line2D entirely contains the specified Rectangle2D.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getBounds sample code for java.awt.geom.Line2D.getBounds() definition code for java.awt.geom.Line2D.getBounds() ()
          Returns the bounding box of this Line2D.
abstract  Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D getP1 sample code for java.awt.geom.Line2D.getP1() definition code for java.awt.geom.Line2D.getP1() ()
          Returns the starting Point2D of this Line2D.
abstract  Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D getP2 sample code for java.awt.geom.Line2D.getP2() definition code for java.awt.geom.Line2D.getP2() ()
          Returns the end Point2D of this Line2D.
 PathIterator sample code for java.awt.geom.PathIterator definition code for java.awt.geom.PathIterator getPathIterator sample code for java.awt.geom.Line2D.getPathIterator(java.awt.geom.AffineTransform) definition code for java.awt.geom.Line2D.getPathIterator(java.awt.geom.AffineTransform) (AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  at)
          Returns an iteration object that defines the boundary of this Line2D.
 PathIterator sample code for java.awt.geom.PathIterator definition code for java.awt.geom.PathIterator getPathIterator sample code for java.awt.geom.Line2D.getPathIterator(java.awt.geom.AffineTransform, double) definition code for java.awt.geom.Line2D.getPathIterator(java.awt.geom.AffineTransform, double) (AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  at, double flatness)
          Returns an iteration object that defines the boundary of this flattened Line2D.
abstract  double getX1 sample code for java.awt.geom.Line2D.getX1() definition code for java.awt.geom.Line2D.getX1() ()
          Returns the X coordinate of the start point in double precision.
abstract  double getX2 sample code for java.awt.geom.Line2D.getX2() definition code for java.awt.geom.Line2D.getX2() ()
          Returns the X coordinate of the end point in double precision.
abstract  double getY1 sample code for java.awt.geom.Line2D.getY1() definition code for java.awt.geom.Line2D.getY1() ()
          Returns the Y coordinate of the start point in double precision.
abstract  double getY2 sample code for java.awt.geom.Line2D.getY2() definition code for java.awt.geom.Line2D.getY2() ()
          Returns the Y coordinate of the end point in double precision.
 boolean intersects sample code for java.awt.geom.Line2D.intersects(double, double, double, double) definition code for java.awt.geom.Line2D.intersects(double, double, double, double) (double x, double y, double w, double h)
          Tests if this Line2D intersects the interior of a specified set of rectangular coordinates.
 boolean intersects sample code for java.awt.geom.Line2D.intersects(java.awt.geom.Rectangle2D) definition code for java.awt.geom.Line2D.intersects(java.awt.geom.Rectangle2D) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
          Tests if this Line2D intersects the interior of a specified Rectangle2D.
 boolean intersectsLine sample code for java.awt.geom.Line2D.intersectsLine(double, double, double, double) definition code for java.awt.geom.Line2D.intersectsLine(double, double, double, double) (double X1, double Y1, double X2, double Y2)
          Tests if the line segment from (X1, Y1) to (X2, Y2) intersects this line segment.
 boolean intersectsLine sample code for java.awt.geom.Line2D.intersectsLine(java.awt.geom.Line2D) definition code for java.awt.geom.Line2D.intersectsLine(java.awt.geom.Line2D) (Line2D sample code for java.awt.geom.Line2D definition code for java.awt.geom.Line2D  l)
          Tests if the specified line segment intersects this line segment.
static boolean linesIntersect sample code for java.awt.geom.Line2D.linesIntersect(double, double, double, double, double, double, double, double) definition code for java.awt.geom.Line2D.linesIntersect(double, double, double, double, double, double, double, double) (double X1, double Y1, double X2, double Y2, double X3, double Y3, double X4, double Y4)
          Tests if the line segment from (X1, Y1) to (X2, Y2) intersects the line segment from (X3, Y3) to (X4, Y4).
 double ptLineDist sample code for java.awt.geom.Line2D.ptLineDist(double, double) definition code for java.awt.geom.Line2D.ptLineDist(double, double) (double PX, double PY)
          Returns the distance from a point to this line.
static double ptLineDist sample code for java.awt.geom.Line2D.ptLineDist(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptLineDist(double, double, double, double, double, double) (double X1, double Y1, double X2, double Y2, double PX, double PY)
          Returns the distance from a point to a line.
 double ptLineDist sample code for java.awt.geom.Line2D.ptLineDist(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptLineDist(java.awt.geom.Point2D) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  pt)
          Returns the distance from a Point2D to this line.
 double ptLineDistSq sample code for java.awt.geom.Line2D.ptLineDistSq(double, double) definition code for java.awt.geom.Line2D.ptLineDistSq(double, double) (double PX, double PY)
          Returns the square of the distance from a point to this line.
static double ptLineDistSq sample code for java.awt.geom.Line2D.ptLineDistSq(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptLineDistSq(double, double, double, double, double, double) (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 sample code for java.awt.geom.Line2D.ptLineDistSq(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptLineDistSq(java.awt.geom.Point2D) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  pt)
          Returns the square of the distance from a specified Point2D to this line.
 double ptSegDist sample code for java.awt.geom.Line2D.ptSegDist(double, double) definition code for java.awt.geom.Line2D.ptSegDist(double, double) (double PX, double PY)
          Returns the distance from a point to this line segment.
static double ptSegDist sample code for java.awt.geom.Line2D.ptSegDist(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptSegDist(double, double, double, double, double, double) (double X1, double Y1, double X2, double Y2, double PX, double PY)
          Returns the distance from a point to a line segment.
 double ptSegDist sample code for java.awt.geom.Line2D.ptSegDist(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptSegDist(java.awt.geom.Point2D) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  pt)
          Returns the distance from a Point2D to this line segment.
 double ptSegDistSq sample code for java.awt.geom.Line2D.ptSegDistSq(double, double) definition code for java.awt.geom.Line2D.ptSegDistSq(double, double) (double PX, double PY)
          Returns the square of the distance from a point to this line segment.
static double ptSegDistSq sample code for java.awt.geom.Line2D.ptSegDistSq(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptSegDistSq(double, double, double, double, double, double) (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 sample code for java.awt.geom.Line2D.ptSegDistSq(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptSegDistSq(java.awt.geom.Point2D) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  pt)
          Returns the square of the distance from a Point2D to this line segment.
 int relativeCCW sample code for java.awt.geom.Line2D.relativeCCW(double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double) (double PX, double PY)
          Returns an indicator of where the specified point (PX, PY) lies with respect to this line segment.
static int relativeCCW sample code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) (double X1, double Y1, double X2, double Y2, double PX, double PY)
          Returns an indicator of where the specified point (PX, PY) lies with respect to the line segment from (X1, Y1) to (X2, Y2).
 int relativeCCW sample code for java.awt.geom.Line2D.relativeCCW(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.relativeCCW(java.awt.geom.Point2D) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p)
          Returns an indicator of where the specified Point2D lies with respect to this line segment.
abstract  void setLine sample code for java.awt.geom.Line2D.setLine(double, double, double, double) definition code for java.awt.geom.Line2D.setLine(double, double, double, double) (double X1, double Y1, double X2, double Y2)
          Sets the location of the endpoints of this Line2D to the specified double coordinates.
 void setLine sample code for java.awt.geom.Line2D.setLine(java.awt.geom.Line2D) definition code for java.awt.geom.Line2D.setLine(java.awt.geom.Line2D) (Line2D sample code for java.awt.geom.Line2D definition code for java.awt.geom.Line2D  l)
          Sets the location of the endpoints of this Line2D to the same as those endpoints of the specified Line2D.
 void setLine sample code for java.awt.geom.Line2D.setLine(java.awt.geom.Point2D, java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.setLine(java.awt.geom.Point2D, java.awt.geom.Point2D) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p1, Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p2)
          Sets the location of the endpoints of this Line2D to the specified Point2D coordinates.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface java.awt.Shape sample code for java.awt.Shape definition code for java.awt.Shape
getBounds2D sample code for java.awt.Shape.getBounds2D() definition code for java.awt.Shape.getBounds2D()
 

Constructor Detail

Line2D sample code for java.awt.geom.Line2D() definition code for java.awt.geom.Line2D()

protected Line2D()
This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessory methods below.

See Also:
Line2D.Float sample code for java.awt.geom.Line2D.Float definition code for java.awt.geom.Line2D.Float , Line2D.Double sample code for java.awt.geom.Line2D.Double definition code for java.awt.geom.Line2D.Double
Method Detail

getX1 sample code for java.awt.geom.Line2D.getX1() definition code for java.awt.geom.Line2D.getX1()

public abstract double getX1()
Returns the X coordinate of the start point in double precision.

Returns:
the X coordinate of this Line2D object's starting point.

getY1 sample code for java.awt.geom.Line2D.getY1() definition code for java.awt.geom.Line2D.getY1()

public abstract double getY1()
Returns the Y coordinate of the start point in double precision.

Returns:
the Y coordinate of this Line2D object's starting point.

getP1 sample code for java.awt.geom.Line2D.getP1() definition code for java.awt.geom.Line2D.getP1()

public abstract Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  getP1()
Returns the starting Point2D of this Line2D.

Returns:
the starting Point2D of this Line2D.

getX2 sample code for java.awt.geom.Line2D.getX2() definition code for java.awt.geom.Line2D.getX2()

public abstract double getX2()
Returns the X coordinate of the end point in double precision.

Returns:
the X coordinate of this Line2D object's starting point.

getY2 sample code for java.awt.geom.Line2D.getY2() definition code for java.awt.geom.Line2D.getY2()

public abstract double getY2()
Returns the Y coordinate of the end point in double precision.

Returns:
the Y coordinate of this Line2D object's starting point.

getP2 sample code for java.awt.geom.Line2D.getP2() definition code for java.awt.geom.Line2D.getP2()

public abstract Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  getP2()
Returns the end Point2D of this Line2D.

Returns:
a Point2D that is the endpoint of this Line2D.

setLine sample code for java.awt.geom.Line2D.setLine(double, double, double, double) definition code for java.awt.geom.Line2D.setLine(double, double, double, double)

public abstract void setLine(double X1,
                             double Y1,
                             double X2,
                             double Y2)
Sets the location of the endpoints of this Line2D to the specified double coordinates.

Parameters:
X1, Y1 - the first specified coordinate
X2, Y2 - the second specified coordinate

setLine sample code for java.awt.geom.Line2D.setLine(java.awt.geom.Point2D, java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.setLine(java.awt.geom.Point2D, java.awt.geom.Point2D)

public void setLine(Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p1,
                    Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p2)
Sets the location of the endpoints of this Line2D to the specified Point2D coordinates.

Parameters:
p1, p2 - the specified Point2D objects

setLine sample code for java.awt.geom.Line2D.setLine(java.awt.geom.Line2D) definition code for java.awt.geom.Line2D.setLine(java.awt.geom.Line2D)

public void setLine(Line2D sample code for java.awt.geom.Line2D definition code for java.awt.geom.Line2D  l)
Sets the location of the endpoints of this Line2D to the same as those endpoints of the specified Line2D.

Parameters:
l - the specified Line2D

relativeCCW sample code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double)

public 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) lies with respect to the line segment from (X1, Y1) to (X2, Y2). The return value can be either 1, -1, or 0 and indicates in which direction the specified line must pivot around its first endpoint, (X1, Y1), in order to point at the specified point (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 endpoints, then the value will be -1 if the point lies "beyond (X1, Y1)" or 1 if the point lies "beyond (X2, Y2)".

Parameters:
X1, Y1 - the coordinates of the beginning of the specified line segment
X2, Y2 - the coordinates of the end of the specified line segment
PX, PY - the coordinates of the specified point to be compared with the specified line segment
Returns:
an integer that indicates the position of the third specified coordinates with respect to the line segment formed by the first two specified coordinates.

relativeCCW sample code for java.awt.geom.Line2D.relativeCCW(double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double)

public int relativeCCW(double PX,
                       double PY)
Returns an indicator of where the specified point (PX, PY) lies with respect to this line segment. See the method comments of relativeCCW(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) to interpret the return value.

Parameters:
PX, PY - the coordinates of the specified point to be compared with the current line segment
Returns:
an integer that indicates the position of the specified coordinates with respect to the current line segment.
See Also:
relativeCCW(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double)

relativeCCW sample code for java.awt.geom.Line2D.relativeCCW(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.relativeCCW(java.awt.geom.Point2D)

public int relativeCCW(Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p)
Returns an indicator of where the specified Point2D lies with respect to this line segment. See the method comments of relativeCCW(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) to interpret the return value.

Parameters:
p - the specified Point2D to be compared with the current line segment
Returns:
an integer that indicates the position of the Point2D with respect to the current line segment.
See Also:
relativeCCW(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.relativeCCW(double, double, double, double, double, double)

linesIntersect sample code for java.awt.geom.Line2D.linesIntersect(double, double, double, double, double, double, double, double) definition code for java.awt.geom.Line2D.linesIntersect(double, double, double, double, double, double, double, double)

public 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) to (X2, Y2) intersects the line segment from (X3, Y3) to (X4, Y4).

Parameters:
X1, Y1 - the coordinates of the beginning of the first specified line segment
X2, Y2 - the coordinates of the end of the first specified line segment
X3, Y3 - the coordinates of the beginning of the second specified line segment
X4, Y4 - the coordinates of the end of the second specified line segment
Returns:
true if the first specified line segment and the second specified line segment intersect each other; false otherwise.

intersectsLine sample code for java.awt.geom.Line2D.intersectsLine(double, double, double, double) definition code for java.awt.geom.Line2D.intersectsLine(double, double, double, double)

public boolean intersectsLine(double X1,
                              double Y1,
                              double X2,
                              double Y2)
Tests if the line segment from (X1, Y1) to (X2, Y2) intersects this line segment.

Parameters:
X1, Y1 - the coordinates of the beginning of the specified line segment
X2, Y2 - the coordinates of the end of the specified line segment
Returns:
if this line segment and the specified line segment intersect each other; false otherwise.

intersectsLine sample code for java.awt.geom.Line2D.intersectsLine(java.awt.geom.Line2D) definition code for java.awt.geom.Line2D.intersectsLine(java.awt.geom.Line2D)

public boolean intersectsLine(Line2D sample code for java.awt.geom.Line2D definition code for java.awt.geom.Line2D  l)
Tests if the specified line segment intersects this line segment.

Parameters:
l - the specified Line2D
Returns:
true if this line segment and the specified line segment intersect each other; false otherwise.

ptSegDistSq sample code for java.awt.geom.Line2D.ptSegDistSq(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptSegDistSq(double, double, double, double, double, double)

public 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. The distance measured is the distance between the specified point and the closest point between the specified endpoints. If the specified point intersects the line segment in between the endpoints, this method returns 0.0.

Parameters:
X1, Y1 - the coordinates of the beginning of the specified line segment
X2, Y2 - the coordinates of the end of the specified line segment
PX, PY - the coordinates of the specified point being measured against the specified line segment
Returns:
a double value that is the square of the distance from the specified point to the specified line segment.
See Also:
ptLineDistSq(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.ptLineDistSq(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptLineDistSq(double, double, double, double, double, double)

ptSegDist sample code for java.awt.geom.Line2D.ptSegDist(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptSegDist(double, double, double, double, double, double)

public 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. The distance measured is the distance between the specified point and the closest point between the specified endpoints. If the specified point intersects the line segment in between the endpoints, this method returns 0.0.

Parameters:
X1, Y1 - the coordinates of the beginning of the specified line segment
X2, Y2 - the coordinates of the end of the specified line segment
PX, PY - the coordinates of the specified point being measured against the specified line segment
Returns:
a double value that is the distance from the specified point to the specified line segment.
See Also:
ptLineDist(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.ptLineDist(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptLineDist(double, double, double, double, double, double)

ptSegDistSq sample code for java.awt.geom.Line2D.ptSegDistSq(double, double) definition code for java.awt.geom.Line2D.ptSegDistSq(double, double)

public double ptSegDistSq(double PX,
                          double PY)
Returns the square of the distance from a point to this line segment. The distance measured is the distance between the specified point and the closest point between the current line's endpoints. If the specified point intersects the line segment in between the endpoints, this method returns 0.0.

Parameters:
PX, PY - the coordinates of the specified point being measured against this line segment
Returns:
a double value that is the square of the distance from the specified point to the current line segment.
See Also:
ptLineDistSq(double, double) sample code for java.awt.geom.Line2D.ptLineDistSq(double, double) definition code for java.awt.geom.Line2D.ptLineDistSq(double, double)

ptSegDistSq sample code for java.awt.geom.Line2D.ptSegDistSq(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptSegDistSq(java.awt.geom.Point2D)

public double ptSegDistSq(Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  pt)
Returns the square of the distance from a Point2D to this line segment. The distance measured is the distance between the specified point and the closest point between the current line's endpoints. If the specified point intersects the line segment in between the endpoints, this method returns 0.0.

Parameters:
pt - the specified Point2D being measured against this line segment.
Returns:
a double value that is the square of the distance from the specified Point2D to the current line segment.
See Also:
ptLineDistSq(Point2D) sample code for java.awt.geom.Line2D.ptLineDistSq(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptLineDistSq(java.awt.geom.Point2D)

ptSegDist sample code for java.awt.geom.Line2D.ptSegDist(double, double) definition code for java.awt.geom.Line2D.ptSegDist(double, double)

public double ptSegDist(double PX,
                        double PY)
Returns the distance from a point to this line segment. The distance measured is the distance between the specified point and the closest point between the current line's endpoints. If the specified point intersects the line segment in between the endpoints, this method returns 0.0.

Parameters:
PX, PY - the coordinates of the specified point being measured against this line segment
Returns:
a double value that is the distance from the specified point to the current line segment.
See Also:
ptLineDist(double, double) sample code for java.awt.geom.Line2D.ptLineDist(double, double) definition code for java.awt.geom.Line2D.ptLineDist(double, double)

ptSegDist sample code for java.awt.geom.Line2D.ptSegDist(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptSegDist(java.awt.geom.Point2D)

public double ptSegDist(Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  pt)
Returns the distance from a Point2D to this line segment. The distance measured is the distance between the specified point and the closest point between the current line's endpoints. If the specified point intersects the line segment in between the endpoints, this method returns 0.0.

Parameters:
pt - the specified Point2D being measured against this line segment
Returns:
a double value that is the distance from the specified Point2D to the current line segment.
See Also:
ptLineDist(Point2D) sample code for java.awt.geom.Line2D.ptLineDist(java.awt.geom.Point2D) definition code for java.awt.geom.Line2D.ptLineDist(java.awt.geom.Point2D)

ptLineDistSq sample code for java.awt.geom.Line2D.ptLineDistSq(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptLineDistSq(double, double, double, double, double, double)

public 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. The distance measured is the distance between the specified point and the closest point on the infinitely-extended line defined by the specified coordinates. If the specified point intersects the line, this method returns 0.0.

Parameters:
X1, Y1 - the coordinates of one point on the specified line
X2, Y2 - the coordinates of another point on the specified line
PX, PY - the coordinates of the specified point being measured against the specified line
Returns:
a double value that is the square of the distance from the specified point to the specified line.
See Also:
ptSegDistSq(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.ptSegDistSq(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptSegDistSq(double, double, double, double, double, double)

ptLineDist sample code for java.awt.geom.Line2D.ptLineDist(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptLineDist(double, double, double, double, double, double)

public static double ptLineDist(double X1,
                                double Y1,
                                double X2,
                                double Y2,
                                double PX,
                                double PY)
Returns the distance from a point to a line. The distance measured is the distance between the specified point and the closest point on the infinitely-extended line defined by the specified coordinates. If the specified point intersects the line, this method returns 0.0.

Parameters:
X1, Y1 - the coordinates of one point on the specified line
X2, Y2 - the coordinates of another point on the specified line
PX, PY - the coordinates of the specified point being measured against the specified line
Returns:
a double value that is the distance from the specified point to the specified line.
See Also:
ptSegDist(double, double, double, double, double, double) sample code for java.awt.geom.Line2D.ptSegDist(double, double, double, double, double, double) definition code for java.awt.geom.Line2D.ptSegDist(double, double, double, double, double, double)

ptLineDistSq sample code for java.awt.geom.Line2D.ptLineDistSq(double, double) definition code for java.awt.geom.Line2D.ptLineDistSq(double, double)

public double ptLineDistSq(double PX,
                           double PY)
Returns the square of the distance from a point to this line. The distance measured is the distance between the specified point and the closest point on the infinitely-extended line defined by this Line2D. If the specified point intersects the line, this method returns 0.0.

Parameters:
PX, PY - the coordinates of the specified point being measured against this line
Returns:
a double value that is