All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class sg.Line
java.lang.Object
   |
   +----sg.Line
  -  public class Line
  -  extends Object
  -  implements Polygon
Theclass Line defines a geometric object line.
   
  -   Line() Line()
-   Default zero-parameter constructor that sets the line
 to the default line consisting of a single pixel at (0,0).
  
-   Line(Pixel, Pixel) Line(Pixel, Pixel)
-   Two-parameter constructor
 
   
  -   isParallel(Line) isParallel(Line)
-   Returns trueif the slope of the object line is the same as
 the slope of the line L.
-   paint(Graphics) paint(Graphics)
-   Draws the line on the graphic device g.
  
-   slope() slope()
-   Computes the slope of the line.
   
 Line
Line
 public Line()
  -  Default zero-parameter constructor that sets the line
 to the default line consisting of a single pixel at (0,0).
 
 Line
Line
 public Line(Pixel start,
             Pixel end)
  -  Two-parameter constructor
   
- 
    -  Parameters:
    
-  start - starting pixel of the line
    -  end - ending pixel of the line
  
 
   
 slope
slope
 public double slope()
  -  Computes the slope of the line.
   
- 
    -  Returns:
    
-  double the slope.  If the line is vertical, return
         Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY as 
         appropriate.
  
 
 isParallel
isParallel
 public boolean isParallel(Line L)
  -  Returns trueif the slope of the object line is the same as
 the slope of the line L.
   
- 
    -  Parameters:
    
-  L - the line whose slope is to be compared to the slope
          of the object line.
    
-  Returns:
    
-  trueif the slope of the object is the same as
         the slope of the argument;falseotherwise.
 
 paint
paint
 public void paint(Graphics g)
  -  Draws the line on the graphic device g.
   
- 
    -  Parameters:
    
-  g - the simple graphics device on which to draw.
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index