optics.graphics
Class Singlet2D

java.lang.Object
  extended by optics.Optics
      extended by optics.graphics.Singlet2D
All Implemented Interfaces:
Diagram2DComponent

public class Singlet2D
extends Optics
implements Diagram2DComponent

Class to draw a Singlet lens in the Graphics2D scheme


Field Summary
 
Fields inherited from class optics.Optics
DEFAULT_WAVELENGTH, errorStream, fmt, MICRONS
 
Constructor Summary
Singlet2D(OpticalSurface f, OpticalSurface b)
          Form a Singlet2D object with a specified front and back OpticalSurface.
 
Method Summary
 void draw(java.awt.Graphics2D g)
          Method to actually draw the lens in a Graphics2D context.
 java.awt.geom.Rectangle2D getBounds()
          Method to get the bounds of the lens being a box which enclosed the lens in global coordinates.
 void setIndexColour(java.awt.Color c)
          Method to set/reset the index colour being the colour used to represent the ``glass''.
 
Methods inherited from class optics.Optics
getDefaultWaveLength, getErrorStream, getFormatString, getName, getStaticName, getVersion, printError, setDefaultWaveLength, setErrorStream, setFormatString, setMicrons
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Singlet2D

public Singlet2D(OpticalSurface f,
                 OpticalSurface b)
Form a Singlet2D object with a specified front and back OpticalSurface.

The front surface must be REFRACTING and the refractive index between the surfaces must be defined (and NOT Air).

Parameters:
f - the front OpticalSurface
b - the back OpticalSurface
Method Detail

setIndexColour

public void setIndexColour(java.awt.Color c)
Method to set/reset the index colour being the colour used to represent the ``glass''. By defaults this is set the Color returned by Colour.RefractiveIndexColour(double) at wavelengths Constants.GREEN.

Parameters:
c - the Color to to the glass.
See Also:
Colour.RefractiveIndexColour(double)

getBounds

public java.awt.geom.Rectangle2D getBounds()
Method to get the bounds of the lens being a box which enclosed the lens in global coordinates.

Specified by:
getBounds in interface Diagram2DComponent
Returns:
Rectangle2D the bounds

draw

public void draw(java.awt.Graphics2D g)
Method to actually draw the lens in a Graphics2D context. The surfaces are draw using quadric curves with the control points set by the on-axis and edge points. The actual curve does not depend only curve type so may be slightly out for highly curves surfaces. This is only a drawing artifact and does not affect the actual ray calculations.

Specified by:
draw in interface Diagram2DComponent
Parameters:
g - the Graphics2D context