java.awt.geom

Class Line2D.Double

Enclosing Class:
Line2D
Implemented Interfaces:
Cloneable, Shape

public static class Line2D.Double
extends Line2D

This class defines a point in double precision.
Since:
1.2

Nested Class Summary

Nested classes/interfaces inherited from class java.awt.geom.Line2D

Line2D.Double, Line2D.Float

Field Summary

double
x1
The x coordinate of the first point.
double
x2
The x coordinate of the second point.
double
y1
The y coordinate of the first point.
double
y2
The y coordinate of the second point.

Constructor Summary

Double()
Construct the line segment (0,0)->(0,0).
Double(double x1, double y1, double x2, double y2)
Construct the line segment with the specified points.
Double(Point2D p1, Point2D p2)
Construct the line segment with the specified points.

Method Summary

Rectangle2D
getBounds2D()
Return the exact bounds of this line segment.
Point2D
getP1()
Return the first point.
Point2D
getP2()
Return the second point.
double
getX1()
Return the x coordinate of the first point.
double
getX2()
Return the x coordinate of the second point.
double
getY1()
Return the y coordinate of the first point.
double
getY2()
Return the y coordinate of the second point.
void
setLine(double x1, double y1, double x2, double y2)
Set this line to the given points.

Methods inherited from class java.awt.geom.Line2D

clone, contains, contains, contains, contains, getBounds, getP1, getP2, getPathIterator, getPathIterator, getX1, getX2, getY1, getY2, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine, setLine

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

x1

public double x1
The x coordinate of the first point.

x2

public double x2
The x coordinate of the second point.

y1

public double y1
The y coordinate of the first point.

y2

public double y2
The y coordinate of the second point.

Constructor Details

Double

public Double()
Construct the line segment (0,0)->(0,0).

Double

public Double(double x1,
              double y1,
              double x2,
              double y2)
Construct the line segment with the specified points.
Parameters:
x1 - the x coordinate of the first point
y1 - the y coordinate of the first point
x2 - the x coordinate of the second point
y2 - the y coordinate of the second point

Double

public Double(Point2D p1,
              Point2D p2)
Construct the line segment with the specified points.
Parameters:
p1 - the first point
p2 - the second point
Throws:
NullPointerException - if either point is null

Method Details

getBounds2D

public Rectangle2D getBounds2D()
Return the exact bounds of this line segment.
Specified by:
getBounds2D in interface Shape
Returns:
the bounding box

getP1

public Point2D getP1()
Return the first point.
Overrides:
getP1 in interface Line2D
Returns:
the point (x1,y1)

getP2

public Point2D getP2()
Return the second point.
Overrides:
getP2 in interface Line2D
Returns:
the point (x2,y2)

getX1

public double getX1()
Return the x coordinate of the first point.
Overrides:
getX1 in interface Line2D
Returns:
the value of x1

getX2

public double getX2()
Return the x coordinate of the second point.
Overrides:
getX2 in interface Line2D
Returns:
the value of x2

getY1

public double getY1()
Return the y coordinate of the first point.
Overrides:
getY1 in interface Line2D
Returns:
the value of y1

getY2

public double getY2()
Return the y coordinate of the second point.
Overrides:
getY2 in interface Line2D
Returns:
the value of y2

setLine

public void setLine(double x1,
                    double y1,
                    double x2,
                    double y2)
Set this line to the given points.
Overrides:
setLine in interface Line2D
Parameters:
x1 - the new x coordinate of the first point
y1 - the new y coordinate of the first point
x2 - the new x coordinate of the second point
y2 - the new y coordinate of the second point

Line2D.java -- represents a line in 2-D space, plus operations on a line Copyright (C) 2000, 2001, 2002 Free Software Foundation This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.