java.awt.geom
Class Line2D.Float

java.lang.Object
  extended by java.awt.geom.Line2D
      extended by java.awt.geom.Line2D.Float
All Implemented Interfaces:
Shape, Cloneable
Direct Known Subclasses:
Line
Enclosing class:
Line2D

public static class Line2D.Float
extends Line2D

A line in 2D space using float coordinates


Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Line2D
Line2D.Double, Line2D.Float
 
Field Summary
 float x1
          The x coordinate of the start of the line
 float x2
          The x coordinate of the end of the line
 float y1
          The y coordinate of the start of the line
 float y2
          The y coordinate of the end of the line
 
Constructor Summary
Line2D.Float()
          Creates a zero length line at (0,0)
Line2D.Float(float x1, float y1, float x2, float y2)
          Create a line from (x1,y1) to (x2,y2)
 
Method Summary
 Rectangle2D getBounds2D()
          Get the bounds of the line as a Rectangle2D
 Point2D getP1()
          Get the start point of the line as a Point2D
 Point2D getP2()
          Get the end point of the line as a Point2D
 double getX1()
          Get the x coordinate of the start of the line
 double getX2()
          Get the x coordinate of the end of the line
 double getY1()
          Get the y coordinate of the start of the line
 double getY2()
          Get the y coordinate of the end of the line
 void setLine(double x1, double y1, double x2, double y2)
          Sets the end points of the line using double coordinates.
 void setLine(float x1, float y1, float x2, float y2)
          Set the float coordinates of the start and end of the line
 
Methods inherited from class java.awt.geom.Line2D
clone, contains, contains, contains, contains, getBounds, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, relativeCCW, relativeCCW, relativeCCW, setLine, setLine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x1

public float x1
The x coordinate of the start of the line


y1

public float y1
The y coordinate of the start of the line


x2

public float x2
The x coordinate of the end of the line


y2

public float y2
The y coordinate of the end of the line

Constructor Detail

Line2D.Float

public Line2D.Float()
Creates a zero length line at (0,0)


Line2D.Float

public Line2D.Float(float x1,
                    float y1,
                    float x2,
                    float y2)
Create a line from (x1,y1) to (x2,y2)

Parameters:
x1 - the x coordinate of the start of the line
y1 - the y coordinate of the start of the line
x2 - the x coordinate of the end of the line
y2 - the y coordinate of the end of the line
Method Detail

setLine

public void setLine(float x1,
                    float y1,
                    float x2,
                    float y2)
Set the float coordinates of the start and end of the line

Parameters:
x1 - the x coordinate of the start of the line
y1 - the y coordinate of the start of the line
x2 - the x coordinate of the end of the line
y2 - the y coordinate of the end of the line

getBounds2D

public Rectangle2D getBounds2D()
Get the bounds of the line as a Rectangle2D

Returns:
the bounding Rectangle2D

getX1

public double getX1()
Description copied from class: Line2D
Get the x coordinate of the start of the line

Specified by:
getX1 in class Line2D
Returns:
the x coordinate as a double

getY1

public double getY1()
Description copied from class: Line2D
Get the y coordinate of the start of the line

Specified by:
getY1 in class Line2D
Returns:
the y coordinate as a double

getP1

public Point2D getP1()
Description copied from class: Line2D
Get the start point of the line as a Point2D

Specified by:
getP1 in class Line2D
Returns:
the Point2D

getX2

public double getX2()
Description copied from class: Line2D
Get the x coordinate of the end of the line

Specified by:
getX2 in class Line2D
Returns:
the x coordinate as a double

getY2

public double getY2()
Description copied from class: Line2D
Get the y coordinate of the end of the line

Specified by:
getY2 in class Line2D
Returns:
the y coordinate as a double

getP2

public Point2D getP2()
Description copied from class: Line2D
Get the end point of the line as a Point2D

Specified by:
getP2 in class Line2D
Returns:
the Point2D

setLine

public void setLine(double x1,
                    double y1,
                    double x2,
                    double y2)
Description copied from class: Line2D
Sets the end points of the line using double coordinates.

Specified by:
setLine in class Line2D
Parameters:
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