optics
Class RayVector

java.lang.Object
  extended by optics.Optics
      extended by optics.Ray
          extended by optics.RayVector
Direct Known Subclasses:
IntensityRay

public abstract class RayVector
extends Ray

Abstract class that defines the fundamental ray geometry and the method to manipulate them. The practical use of this lass in via the extending classes currently IntensityRay. Will Hossack, The University of Edinburgh This file is part of Optics. Optics is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Optics is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Optics. If not, see .


Field Summary
protected  double currentIndex
          Current numerical value of refractive index, Default to Constants.AIR.
protected  Director director
          The Ray director (or direction cosine)
protected  double opticalPathLength
          Optical path-length transversed by the ray.
protected  Position position
          The Ray position in space
 
Fields inherited from class optics.Ray
intensity, monitor, waveLength
 
Fields inherited from class optics.Optics
DEFAULT_WAVELENGTH, errorStream, fmt, MICRONS
 
Constructor Summary
RayVector()
           
 
Method Summary
 void addPathLength(double d)
          Method add a path dto the optical path taking into account the current refractive index n.
 double distance(RayVector ray)
          Method to calculate the distance from this Ray to a specified Ray.
 double getCurrentIndex()
          Method to get the current index value.
 Director getDirector()
          Method get the director of the RayVector.
 double getNormalisedOpticalPathLength()
          Method to get the normalsied Optical Path length in units of wavelength.
 double getOpticalPathLength()
          Method to get optical path length in package units, unusually mm.
 Position getPosition()
          Method get the position of the RayVector
 boolean isInvalid()
          Boolean to test if ray is invalid
 javax.vecmath.Point2d pointInPlane(double plane)
          Method to calculate the point where this ray will intersect a x/y plane specified by it location on the optical z-axis.
 boolean propagate(double distance)
          Boolean method to propagate the ray a specified distance.
 boolean propagate(OpticalSurface s)
          Boolean method to propagate a ray to a specified OpticalSurface.
 boolean propagateThrough(LensSystem ls)
          Method to propagate a RayVector through an LensSystem.
 boolean propagateThrough(OpticalSurface s)
          Method propagate through an OpticalSurface.
 boolean reflection(Director u)
          Boolean method to reflect the ray from a surface specified by the surface normal.
 boolean refraction(Director u, double refractiveIndex)
          Boolean method to refract the ray through a surface specified by the surface normal and refractive index.
 void setCurrentIndex(double n)
          Method to set the current refractive index value.
 void setDirector(Director u)
          Method to set the director of the RayVector.
 void setInvalid()
          Method to set the ray to be invalid by setting director to be invalid.
 void setOpticalPathLength(double opl)
          Method to set the absolute optical path length in package units (usually mm).
 void setPosition(Position p)
          Method to set the position of the RayVector.
 java.lang.String toString()
          String method to get the ray as a formatted String
 
Methods inherited from class optics.Ray
addMonitor, clearMonitor, getIntensity, getMonitor, getWaveLength, isValid, monitorUpdate, setIntensity, setWaveLength
 
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, wait, wait, wait
 

Field Detail

position

protected Position position
The Ray position in space


director

protected Director director
The Ray director (or direction cosine)


opticalPathLength

protected double opticalPathLength
Optical path-length transversed by the ray. Starts at zero.


currentIndex

protected double currentIndex
Current numerical value of refractive index, Default to Constants.AIR. This will be automatically updated as it passes through optical surfaces.

Constructor Detail

RayVector

public RayVector()
Method Detail

setPosition

public void setPosition(Position p)
Method to set the position of the RayVector.

Parameters:
p - the position

getPosition

public Position getPosition()
Method get the position of the RayVector

Specified by:
getPosition in class Ray
Returns:
Position the position.

setDirector

public void setDirector(Director u)
Method to set the director of the RayVector.

Parameters:
u - the direction.

getDirector

public Director getDirector()
Method get the director of the RayVector.

Returns:
Director the current director.

setCurrentIndex

public void setCurrentIndex(double n)
Method to set the current refractive index value.

Not normally called by users, normally set automatically as ray propagates.

Parameters:
n - the numerical value of the current index.

getCurrentIndex

public double getCurrentIndex()
Method to get the current index value.

Returns:
double the current index value.

setOpticalPathLength

public void setOpticalPathLength(double opl)
Method to set the absolute optical path length in package units (usually mm).

Parameters:
opl - the optical path length

getOpticalPathLength

public double getOpticalPathLength()
Method to get optical path length in package units, unusually mm.

Returns:
double the optical path length

getNormalisedOpticalPathLength

public double getNormalisedOpticalPathLength()
Method to get the normalsied Optical Path length in units of wavelength.

If the path length is long this can be a very large number so further calculations may be subject to numerical rounding errors. Use with care.

Returns:
double optical path length in wavelengths

addPathLength

public void addPathLength(double d)
Method add a path dto the optical path taking into account the current refractive index n. The length added is nd.

Parameters:
d - the physical path length.

setInvalid

public void setInvalid()
Method to set the ray to be invalid by setting director to be invalid. This will prevent further propagation.

Specified by:
setInvalid in class Ray

isInvalid

public boolean isInvalid()
Boolean to test if ray is invalid

Specified by:
isInvalid in class Ray
Returns:
boolean true if invalid

propagate

public boolean propagate(double distance)
Boolean method to propagate the ray a specified distance. The optical path length is updated, and if a RayMonitor is defined, then this is automatically updated with the new position.

If ray is set invalid or distance is Double.NaN is then position or optical path length will not be altered, and no RayMonitor is updates. If the distance is Double.NaN the current ray will also be set invalid, so preventing further propagation.

Parameters:
distance - the distance to propagate
Returns:
boolean true if success, false if ray of distance invalid.

propagate

public boolean propagate(OpticalSurface s)
Boolean method to propagate a ray to a specified OpticalSurface. The distance to the surface is found and then the ray propagated to it. If the propagation fail the ray will be set to be invalid.

After propagation the ray will be immediately before the surface.

Parameters:
s - the OpticalSurface
Returns:
boolean true if successful, false if unsuccessful, and ray set invalid.
See Also:
propagateThrough(optics.OpticalSurface)

reflection

public boolean reflection(Director u)
Boolean method to reflect the ray from a surface specified by the surface normal. The ray is assume to be located immediately before the surface.

If u is invalid, ray will be set invalid

Parameters:
u - the surface normal.
Returns:
boolean true for success, false for failure.

refraction

public boolean refraction(Director u,
                          double refractiveIndex)
Boolean method to refract the ray through a surface specified by the surface normal and refractive index. The Ray is assumed to be at the surface. If successful, then the current index of the ray will be set to the specified index.

If normal is invalid, ray will be set invalid, but if above critical angle, the ray director will not be altered.

Parameters:
u - the surface normal.
Returns:
boolean true for success, false for failure.

propagateThrough

public boolean propagateThrough(OpticalSurface s)
Method propagate through an OpticalSurface. The Ray will be propagated to surface first and then refracted or if mirror, reflected. If the surface is non-refracting, then its direction will not be altered but it will be tested for propagation through the surface apertrure limits.

If either the propagation or the refraction/reflection is unsuccessful, the ray will be set invalid.

Parameters:
s - the optical surface
Returns:
boolean true for success, false for failure.
See Also:
propagate(optics.OpticalSurface), refraction(optics.Director, double), reflection(optics.Director)

propagateThrough

public boolean propagateThrough(LensSystem ls)
Method to propagate a RayVector through an LensSystem. successfully passed through. If the ray is blocked or otherwise lost, it will be set to invalid and propagation halted.

Note if RayMonitor set it will be updated on each propagation.

Parameters:
ls - the LensSystem
Returns:
boolean true if propagated through whole system
See Also:
propagateThrough(optics.OpticalSurface)

pointInPlane

public javax.vecmath.Point2d pointInPlane(double plane)
Method to calculate the point where this ray will intersect a x/y plane specified by it location on the optical z-axis.

Note this does NOT propagate the ray to the plane so does not change the rays position.

Specified by:
pointInPlane in class Ray
Parameters:
plane - the z location of the plane
Returns:
Point2d the location in the plane.

distance

public double distance(RayVector ray)
Method to calculate the distance from this Ray to a specified Ray. This does not alter the position of either Ray.

Parameters:
ray - the second Ray
Returns:
double the distance

toString

public java.lang.String toString()
String method to get the ray as a formatted String

Overrides:
toString in class java.lang.Object
Returns:
String the formatted String