lejos.geom
Class Line

java.lang.Object
  extended by java.awt.geom.Line2D
      extended by java.awt.geom.Line2D.Float
          extended by lejos.geom.Line
All Implemented Interfaces:
Shape, Cloneable

public class Line
extends Line2D.Float

Represents a line and supports calculating the point of intersection of two line segments.

Author:
Lawrie Griffiths

WARNING: THIS CLASS IS SHARED BETWEEN THE classes AND pccomms PROJECTS. DO NOT EDIT THE VERSION IN pccomms AS IT WILL BE OVERWRITTEN WHEN THE PROJECT IS BUILT.

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Line2D
Line2D.Double, Line2D.Float
 
Field Summary
 
Fields inherited from class java.awt.geom.Line2D.Float
x1, x2, y1, y2
 
Constructor Summary
Line(float x1, float y1, float x2, float y2)
           
 
Method Summary
 Point intersectsAt(Line l)
          Calculate the point of intersection of two lines.
 float length()
          Return the length of the line
 
Methods inherited from class java.awt.geom.Line2D.Float
getBounds2D, getP1, getP2, getX1, getX2, getY1, getY2, setLine, setLine
 
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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Line

public Line(float x1,
            float y1,
            float x2,
            float y2)
Method Detail

intersectsAt

public Point intersectsAt(Line l)
Calculate the point of intersection of two lines.

Parameters:
l - the second line
Returns:
the point of intersection or null if the lines do not intercept or are coincident

length

public float length()
Return the length of the line

Returns:
the length of the line