public class LineSegment extends Geometry implements Cloneable
| Constructor and Description | 
|---|
| LineSegment(double[] p1,
           double[] p2)Constructor | 
| LineSegment(double x1,
           double y1,
           double x2,
           double y2)Constructor | 
| LineSegment(LineSegment l2)Copy constructor | 
| LineSegment(Point point1,
           Point point2)Constructor | 
| Modifier and Type | Method and Description | 
|---|---|
| LineSegment | clone()Implements the Cloneable interface and makes an item-by-item copy | 
| double | getDirectionTo(double x,
              double y)Computes the direction (radians) from this line segment to a specified point | 
| double | getDirectionTo(double centerX,
              double centerY,
              double radius)Computes the direction (radians) from the Geometry object to a Circle | 
| double | getDirectionTo(double x1,
              double y1,
              double x2,
              double y2)Computes the direction (radians) from this segment to the closest point on a line segment | 
| double | getDistance(double x,
           double y)Computes the distance from this line segment to a Point | 
| double | getDistance(double centerX,
           double centerY,
           double radius)Computes the distance from the Geometry object to a Circle | 
| double | getDistance(double x1,
           double y1,
           double x2,
           double y2)Computes the distance between this line segment and another line segment | 
| Point | getEnd1()Returns the first end point | 
| Point | getEnd2()Returns the second end point | 
| double[] | getIntersectPoint(double x1,
                 double y1,
                 double x2,
                 double y2)Computes the point of intersection of the extended lines of this and another segment | 
| void | setEnd1(double[] newEnd1)Sets the first end point of the segment | 
| void | setEnd1(double newX,
       double newY)Sets the first end point of the segment | 
| void | setEnd1(Point newEnd1)Sets the first end point of the segment | 
| void | setEnd2(double[] newEnd)Sets the second end point of the segment | 
| void | setEnd2(double newX,
       double newY)Resets the second end point of the segment | 
| void | setEnd2(Point newEnd)Sets the second end point of the segment | 
| void | setEnds(double[] p1,
       double[] p2)Sets both end points of the segment | 
| void | setEnds(double x1,
       double y1,
       double x2,
       double y2)Sets both end points of the segment | 
| void | setEnds(Point newEnd1,
       Point newEnd2)Sets both end points of the segment | 
| String | toString()Generates a string representation of the LineSegment object | 
determinant, dotProduct, getClosestPointOnLine, getClosestPointOnSegment, getDirectionTo, getDirectionTo, getDirectionTo, getDirectionTo, getDirectionTo, getDirectionTo, getDirectionTo, getDistance, getDistance, getDistance, getDistance, getDistance, getDistance, getDistance, getDistance, getIntersectPoint, isInSegment, isOnSegment, pointDirection, pointDistancepublic LineSegment(Point point1, Point point2)
point1 - one end point of the segmentpoint2 - second end point of the segmentpublic LineSegment(double[] p1,
           double[] p2)
p1 - Cartesian coordinate of one end point of the segmentp2 - Cartesian coordinate of the second end point of the segmentpublic LineSegment(double x1,
           double y1,
           double x2,
           double y2)
x1 - north/south Cartesian coordinate of one end point of the segmenty1 - east/west Cartesian coordinate of one end point of the segmentx2 - north/south Cartesian coordinate of the second end point of the segmenty2 - east/west Cartesian coordinate of the second end point of the segmentpublic LineSegment(LineSegment l2)
public LineSegment clone()
public void setEnds(Point newEnd1, Point newEnd2)
newEnd1 - new end pointnewEnd2 - new end pointpublic void setEnds(double[] p1,
           double[] p2)
p1 - Cartesian coordinate of one end point of the segmentp2 - Cartesian coordinate of the second end point of the segmentpublic void setEnds(double x1,
           double y1,
           double x2,
           double y2)
x1 - north/south Cartesian coordinate of one end point of the segmenty1 - east/west Cartesian coordinate of one end point of the segmentx2 - north/south Cartesian coordinate of the second end point of the segmenty2 - east/west Cartesian coordinate of the second end point of the segmentpublic void setEnd1(Point newEnd1)
newEnd1 - new end pointpublic void setEnd1(double[] newEnd1)
newEnd1 - new end pointpublic void setEnd1(double newX,
           double newY)
newX - north/south coordinate of the new end pointnewY - east/west coordinate of the new end pointpublic Point getEnd1()
public void setEnd2(Point newEnd)
newEnd - new end pointpublic void setEnd2(double[] newEnd)
newEnd - new end pointpublic void setEnd2(double newX,
           double newY)
newX - north/south coordinate of the new end pointnewY - east/west coordinate of the new end pointpublic Point getEnd2()
public double getDistance(double x,
                 double y)
getDistance in class Geometryx - north/south coordinate of the point being testedy - east/west coordinate of the point being testedpublic double getDirectionTo(double x,
                    double y)
getDirectionTo in class Geometryx - x coordinate of the point being testedy - y coordinate of the point being testedpublic double getDistance(double centerX,
                 double centerY,
                 double radius)
getDistance in class GeometrycenterX - north/south coordinate of the circle being testedcenterY - east/west coordinate of the circle being testedradius - of the circle being testedpublic double getDirectionTo(double centerX,
                    double centerY,
                    double radius)
getDirectionTo in class GeometrycenterX - x coordinate of the circle being testedcenterY - y coordinate of the circle being testedradius - of the circle being testedpublic double getDistance(double x1,
                 double y1,
                 double x2,
                 double y2)
getDistance in class Geometryx1 - north/south coordinate of the first segment end pointy1 - east west coordinate of the first segment end pointx2 - north/south coordinate of the second segment end pointy2 - east west coordinate of the second segment end pointpublic double getDirectionTo(double x1,
                    double y1,
                    double x2,
                    double y2)
getDirectionTo in class Geometryx1 - north/south coordinate of the first segment end pointy1 - east west coordinate of the first segment end pointx2 - north/south coordinate of the second segment end pointy2 - east west coordinate of the second segment end pointpublic double[] getIntersectPoint(double x1,
                         double y1,
                         double x2,
                         double y2)
x1 - north/south coordinate of the first segment end pointy1 - east west coordinate of the first segment end pointx2 - north/south coordinate of the second segment end pointy2 - east west coordinate of the second segment end point