Class Cross

java.lang.Object
  |
  +--Cross

class Cross
extends java.lang.Object
implements Rotatable, NonTerminal

A basic Cross with a two perpendicular lines.


Field Summary
private  java.util.Vector children
          children
 java.awt.Graphics graphics
          Graphics context for this Geometric object.
private  Line l1
          First line of the cross.
private  Line l2
          Modified l2 to be perpendicular to l1.
private  Line original_l2
          Original l2.
 
Constructor Summary
(package private) Cross(Line l1, Line l2)
          The constructor.
 
Method Summary
 double getAngle()
          Returns the angle of the motor WRT the x axis in radians.
 java.util.Vector getChildren()
          This method should return a vector containing the children of this object.
 Polygon[] getPolygonalBoundsArray()
          This method should return the polygonal array bounds of this non-terminal object.
 Rectangle getRectangularBounds()
          This method should return the Rectangular bounds of this non-terminal object.
 java.lang.String getType()
          Implement Paintable
 void paint()
          Draw the Cross.
 void paint(java.awt.Graphics g)
          Draw the Cross
 void paintOriginal(java.awt.Graphics g)
          This method is used to paint the original data points that forms this GeometricObject
 void setGraphicsContext(java.awt.Graphics g)
          Set graphics context for this Cross object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

original_l2

private Line original_l2
Original l2.

l1

private Line l1
First line of the cross.

l2

private Line l2
Modified l2 to be perpendicular to l1.

children

private java.util.Vector children
children

graphics

public java.awt.Graphics graphics
Graphics context for this Geometric object.
Constructor Detail

Cross

Cross(Line l1,
      Line l2)
The constructor.
Method Detail

getAngle

public double getAngle()
Returns the angle of the motor WRT the x axis in radians. This should be made more general by adding an angle field to the class.Take the angle on the positive x side. Angle is always between 0 and PI/2;
Specified by:
getAngle in interface Rotatable

paint

public void paint()
Draw the Cross.

paint

public void paint(java.awt.Graphics g)
Draw the Cross

setGraphicsContext

public void setGraphicsContext(java.awt.Graphics g)
Set graphics context for this Cross object. Must be set at least once before doing any drawing.

getType

public java.lang.String getType()
Implement Paintable

paintOriginal

public void paintOriginal(java.awt.Graphics g)
This method is used to paint the original data points that forms this GeometricObject

getRectangularBounds

public Rectangle getRectangularBounds()
This method should return the Rectangular bounds of this non-terminal object.
Specified by:
getRectangularBounds in interface NonTerminal

getPolygonalBoundsArray

public Polygon[] getPolygonalBoundsArray()
This method should return the polygonal array bounds of this non-terminal object. This is a rough approximation of the constituents of the object.
Specified by:
getPolygonalBoundsArray in interface NonTerminal

getChildren

public java.util.Vector getChildren()
This method should return a vector containing the children of this object. Children are the Terminal or NonTerminal constituents of this object.
Specified by:
getChildren in interface NonTerminal