optics
Class DistortionGrid

java.lang.Object
  extended by optics.Optics
      extended by optics.OpticalSurface
          extended by optics.OpticalPlane
              extended by optics.DistortionGrid
All Implemented Interfaces:
Diagram2DComponent

public class DistortionGrid
extends OpticalPlane

Class to implement a distortion grid being and OpticalPlane containg a vector of Point2ds which when rendered in a Diagram2D will appear as an grid of crosses.


Field Summary
protected  java.awt.Color crossColour
          Colour the crosses default to Colour.CrossColour
protected  double waveLength
          The wavelength of the grid, defaults DEFAULT_WAVELENGTH.
 
Fields inherited from class optics.OpticalPlane
blockedNormal, maxRadius, planeNormal
 
Fields inherited from class optics.OpticalSurface
CLEAR, group, REFLECTING, REFRACTING, refractiveIndex, surfacePoint, surfaceType
 
Fields inherited from class optics.Optics
DEFAULT_WAVELENGTH, errorStream, fmt, MICRONS
 
Constructor Summary
DistortionGrid(double z)
          Method to create a blank distortion grid at specifed poistion along the optical axis.
DistortionGrid(Position p)
          Form a DistrotionGrid at specifed location.
 
Method Summary
 void addCross(javax.vecmath.Point2d pt)
          Method to add a cross to the
 void addRay(RayVector ray)
          Method to add a ray to the Grid where is intersects the current grid
 void draw(java.awt.Graphics2D g)
          Method to draw the Grid in a Graghics2D context normally automatically called by Disgram2D
 java.awt.geom.Rectangle2D getBounds()
          Method to get the bounds
 javax.vecmath.Point2d getCross(int i)
          Method to get the specifed point relative to the surface origin.
 IntensityRay getIntensityRay(int i, Director u)
          Get a intensity ray of unit intensity from the specifed point
 IntensityRay getIntensityRay(int i, Position pupil)
          Get a intensity ray of unit intensity from the specifed point passing through refeence point.
 Position getPosition(int i)
          Method to get the three dimensional location of a point
 double getWaveLength()
          Method to get the wavelength
 DistortionGrid imagedThrough(OpticalGroup lens, double imagePlane)
          Image the grid through a lens to an spefied image plane
 void scale(double a)
          Method to scale the grid by a constant
 void setColour(java.awt.Color c)
          Method to set the colour of the crosses
 void setCrossSize(double fract)
          Method to set the cross size as percentage of maximum size (default is 5%)
 void setGrid(double width, double height, int xn, int yn)
          Method to setup a regular grid
 void setWaveLength(double lambda)
          Method to set the wavelength
 int size()
          Method get the number of points in the grid
 
Methods inherited from class optics.OpticalPlane
clone, distance, getCurvature, getEdgePlane, getMaxRadius, getNormal, getPlaneNormal, pointInPlane, setMaxRadius, setPlaneNormal, toString
 
Methods inherited from class optics.OpticalSurface
distance, edit, entranceAperture, exitAperture, fromString, fromTokens, getGroup, getIndex, getNormal, getPoint, getRefractiveIndex, getSurfacePoint, getSurfaceType, getSurfaceType, makeStandAlone, pointInPlane, setGroup, setRefractiveIndex, setSurfacePoint, setSurfaceType
 
Methods inherited from class optics.Optics
getDefaultWaveLength, getErrorStream, getFormatString, getName, getStaticName, getVersion, printError, setDefaultWaveLength, setErrorStream, setFormatString, setMicrons
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

crossColour

protected java.awt.Color crossColour
Colour the crosses default to Colour.CrossColour


waveLength

protected double waveLength
The wavelength of the grid, defaults DEFAULT_WAVELENGTH.

Constructor Detail

DistortionGrid

public DistortionGrid(Position p)
Form a DistrotionGrid at specifed location.

Parameters:
p - the reference point.

DistortionGrid

public DistortionGrid(double z)
Method to create a blank distortion grid at specifed poistion along the optical axis.

Parameters:
z - the plane location
Method Detail

setGrid

public void setGrid(double width,
                    double height,
                    int xn,
                    int yn)
Method to setup a regular grid

Parameters:
width - the width of the grid (in mm)
height - the height of the grid (in mm)
xn - number of crosses in x direction
yn - number of crosses in y direction

setColour

public void setColour(java.awt.Color c)
Method to set the colour of the crosses

Parameters:
c - the cross colour

setWaveLength

public void setWaveLength(double lambda)
Method to set the wavelength

Parameters:
lambda - the wavelength

getWaveLength

public double getWaveLength()
Method to get the wavelength

Returns:
double the wavelength.

setCrossSize

public void setCrossSize(double fract)
Method to set the cross size as percentage of maximum size (default is 5%)


addCross

public void addCross(javax.vecmath.Point2d pt)
Method to add a cross to the

Parameters:
pt - the cross to be added

addRay

public void addRay(RayVector ray)
Method to add a ray to the Grid where is intersects the current grid

Parameters:
ray - the RayVector

size

public int size()
Method get the number of points in the grid


getCross

public javax.vecmath.Point2d getCross(int i)
Method to get the specifed point relative to the surface origin.

Parameters:
i - the point index
Returns:
Point2d the Point2d

getPosition

public Position getPosition(int i)
Method to get the three dimensional location of a point

Parameters:
i - the point index
Returns:
Position the three-d location of the Point

getIntensityRay

public IntensityRay getIntensityRay(int i,
                                    Director u)
Get a intensity ray of unit intensity from the specifed point


getIntensityRay

public IntensityRay getIntensityRay(int i,
                                    Position pupil)
Get a intensity ray of unit intensity from the specifed point passing through refeence point.


scale

public void scale(double a)
Method to scale the grid by a constant

Overrides:
scale in class OpticalPlane
Parameters:
a - the scaling paramter

imagedThrough

public DistortionGrid imagedThrough(OpticalGroup lens,
                                    double imagePlane)
Image the grid through a lens to an spefied image plane


getBounds

public java.awt.geom.Rectangle2D getBounds()
Method to get the bounds

Specified by:
getBounds in interface Diagram2DComponent
Overrides:
getBounds in class OpticalPlane
Returns:
Rectangle2D the bounds of the graphic

draw

public void draw(java.awt.Graphics2D g)
Method to draw the Grid in a Graghics2D context normally automatically called by Disgram2D

Specified by:
draw in interface Diagram2DComponent
Overrides:
draw in class OpticalPlane
Parameters:
g - the Graphics2D