optics
Class OpticalGroup

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<OpticalSurface>
              extended by optics.OpticalGroup
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<OpticalSurface>, java.util.Collection<OpticalSurface>, java.util.List<OpticalSurface>, java.util.RandomAccess, LensSystem
Direct Known Subclasses:
Doublet, Singlet

public class OpticalGroup
extends java.util.Vector<OpticalSurface>
implements LensSystem

Class to implement a group of Opticalsurfaces held in a Vector with a group reference point with all the surfaces being defined with respect to that point.

In an optical system this class is usually used to represent a single compound lens. It also implements the LensSystem interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
OpticalGroup(java.lang.String title, double z)
          Form create an OpticalGroup with title and on-axis reference point.
OpticalGroup(java.lang.String title, Position p)
          Form create an OpticalGroup with title and reference.
 
Method Summary
 void addSurface(OpticalSurface s)
          Method to add a surface to the end of the group and increase size by one.
 CircularAperture getAperture()
          Method to get the aperture as a Circular aperture.
 int getApertureSurface()
          Method to get the aperture surface index, of not defines it will be set to -1.
 Diagram2D getDiagram2D()
          Get the Group as a displayable Diagram2D
 CircularAperture getEntranceAperture()
          Get the entrance aperture of the system as a Circular aperture being the physical entrance aperture of the first surface.
 CircularAperture getEntrancePupil(double lambda)
          Get the entrance pupil as a circular aperture being the image of the aperture (back) through the front element(s) using par-axial ray optics.
 CircularAperture getExitAperture()
          Get the exit aperture of the system as a Circular aperture being the physical entrance aperture of the last surface.
 CircularAperture getExitPupil(double lambda)
          Get the exit pupil as a circular aperture being the image of the aperture though back element(s) of lens using par-axial ray optics.
 Position getGroupPoint()
          Method to get the reference point
 OpticalSurface getNext()
          Method to get the next OpticalSurface in order.
 ParaxialGroup getParaxialGroup(double lambda)
          Method to get the Paraxial approximation of the OpticalGroup.
 OpticalSurface getSurface(int i)
          Method to get the ith OpticalSurface
 java.lang.String getTitle()
          Method to return the title String
static OpticalGroup read(java.io.BufferedReader in)
          Static method to read a OpticalGroup
static OpticalGroup read(java.io.File file)
          Static method to read a OpticalGroup from a File
static OpticalGroup read(java.lang.String fileName)
          Static method to read a OpticalGroup by filename
static OpticalGroup readChooser()
          Static method to read an Optical Group via a filechooser windows.
static OpticalGroup readChooser(java.lang.String dir)
          Static method to read an Optical Group staring at the specified directory root.
 void reset()
          Method to reset the surface counter.
 void reverse()
          Method to inverse the lens
 void scale(double a)
          Scale all the optical surfaces in the group, but not the group reference point.
 void setApertureSurface(int m)
          Method to set the aperture surface
 void setBackFocalLength(double lambda, double focal)
          Method to set the paraxial back focal length by scaling the current OpticalGroup
 void setGroupPoint(Position p)
          Method to set the reference point
 void setTitle(java.lang.String t)
          Method to set the title
 boolean write()
          Default write to System.out
 boolean write(java.io.File file)
          Method to write the group to an output File
 boolean write(java.io.PrintStream out)
          Method to write the current group to a PrintStream to suitable commented header.
 boolean write(java.lang.String filename)
          Method to write the group to an output file by filename
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

OpticalGroup

public OpticalGroup(java.lang.String title,
                    Position p)
Form create an OpticalGroup with title and reference.

Parameters:
title -
p - the group reference point

OpticalGroup

public OpticalGroup(java.lang.String title,
                    double z)
Form create an OpticalGroup with title and on-axis reference point.

Parameters:
title -
z - reference point on optical axis
Method Detail

setTitle

public void setTitle(java.lang.String t)
Method to set the title

Parameters:
t - the title

getTitle

public java.lang.String getTitle()
Method to return the title String

Returns:
String The title

setGroupPoint

public void setGroupPoint(Position p)
Method to set the reference point

Parameters:
p - the reference point

getGroupPoint

public Position getGroupPoint()
Method to get the reference point

Returns:
Position the reference point

setApertureSurface

public void setApertureSurface(int m)
Method to set the aperture surface

Parameters:
m - the aperture surface

getApertureSurface

public int getApertureSurface()
Method to get the aperture surface index, of not defines it will be set to -1.

Returns:
intthe aperture surface (if defines)

addSurface

public void addSurface(OpticalSurface s)
Method to add a surface to the end of the group and increase size by one. If the surface it an Aperture it will be taken as the Aperture Surfaces.

Parameters:
s - the OpticalSurface to be added.

getSurface

public OpticalSurface getSurface(int i)
Method to get the ith OpticalSurface

Parameters:
i - The surface index
Returns:
OpticalSurface The surface

scale

public void scale(double a)
Scale all the optical surfaces in the group, but not the group reference point. (Typically used to change the overall focal length of group.).

Parameters:
a - the scale

getAperture

public CircularAperture getAperture()
Method to get the aperture as a Circular aperture. If it is not define, or does not exist, the group entrance aperture is returned.

Returns:
CircularAperture the aperture.

getEntranceAperture

public CircularAperture getEntranceAperture()
Get the entrance aperture of the system as a Circular aperture being the physical entrance aperture of the first surface.

The entrance aperture will be in the current group with its location defined with respect to the group reference point.

Specified by:
getEntranceAperture in interface LensSystem
Returns:
CircularAperture the entrance aperture

getExitAperture

public CircularAperture getExitAperture()
Get the exit aperture of the system as a Circular aperture being the physical entrance aperture of the last surface.

The exit aperture will be in the current group with its location defined with respect to the group reference point.

Specified by:
getExitAperture in interface LensSystem
Returns:
CircularAperture the exit aperture

getEntrancePupil

public CircularAperture getEntrancePupil(double lambda)
Get the entrance pupil as a circular aperture being the image of the aperture (back) through the front element(s) using par-axial ray optics. If there is no aperture defined, this will default to the group entranceAperture.

The aperture will be in the current group with its location defined with respect to the group reference point.

Returns:
CircularAperture the entrance pupil

getExitPupil

public CircularAperture getExitPupil(double lambda)
Get the exit pupil as a circular aperture being the image of the aperture though back element(s) of lens using par-axial ray optics. If there is no aperture defined, then it will default to the exitAperture.

The aperture will be in the current group with its location defined with respect to the group reference point.

Returns:
CircularAperture the exit pupil

getParaxialGroup

public ParaxialGroup getParaxialGroup(double lambda)
Method to get the Paraxial approximation of the OpticalGroup.

Specified by:
getParaxialGroup in interface LensSystem
Parameters:
lambda - the wavelngth
Returns:
ParaxialGroup the paraxial approx.

setBackFocalLength

public void setBackFocalLength(double lambda,
                               double focal)
Method to set the paraxial back focal length by scaling the current OpticalGroup

Parameters:
lambda - the wavelength
focal - the target focal length

getDiagram2D

public Diagram2D getDiagram2D()
Get the Group as a displayable Diagram2D

Specified by:
getDiagram2D in interface LensSystem
Returns:
Diagram2D the displayable Diagram

reset

public void reset()
Method to reset the surface counter.

Specified by:
reset in interface LensSystem

getNext

public OpticalSurface getNext()
Method to get the next OpticalSurface in order. It will return null if there are no surfaces left.

Specified by:
getNext in interface LensSystem
Returns:
OpticalSurface the next surface.

reverse

public void reverse()
Method to inverse the lens


write

public boolean write(java.lang.String filename)
Method to write the group to an output file by filename

Parameters:
filename - the output filename
Returns:
boolean true on success, false on failure.

write

public boolean write(java.io.File file)
Method to write the group to an output File

Parameters:
file - the output File
Returns:
boolean true on success, false on failure.

write

public boolean write()
Default write to System.out


write

public boolean write(java.io.PrintStream out)
Method to write the current group to a PrintStream to suitable commented header.

Parameters:
out - the PrintStream it is written to

readChooser

public static OpticalGroup readChooser()
Static method to read an Optical Group via a filechooser windows.


readChooser

public static OpticalGroup readChooser(java.lang.String dir)
Static method to read an Optical Group staring at the specified directory root. If dir is null, then the environmental variable LENSROOT is used, if this is also null, then finally $HOME is used.

Parameters:
dir - the lens root directory
Returns:
OpticalGroup the read optical group

read

public static OpticalGroup read(java.lang.String fileName)
Static method to read a OpticalGroup by filename

Parameters:
fileName - the filename
Returns:
OpticalGroup the read group.

read

public static OpticalGroup read(java.io.File file)
Static method to read a OpticalGroup from a File

Parameters:
file - the input File
Returns:
OpticalGroup the read group.

read

public static OpticalGroup read(java.io.BufferedReader in)
Static method to read a OpticalGroup

Parameters:
in - the input reader