|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectoptics.Optics
optics.RayPath
public class RayPath
Class to monitor a RayPath by recording the positions
of the Ray using the RayMonitor
interface. This class also implements the
Diagram2DComponent interface so can be directly added
to a Diagram2D.
| Field Summary | |
|---|---|
protected java.util.Vector<Position> |
path
The actual path held in a Vector |
protected double |
waveLength
The wavelength of the ray taking this path. |
| Fields inherited from class optics.Optics |
|---|
DEFAULT_WAVELENGTH, errorStream, fmt, MICRONS |
| Constructor Summary | |
|---|---|
RayPath()
Default constructor to form a blank RayPath not connected to any ray. |
|
RayPath(Ray r)
Constructor to form blank RayPath and attach
it to a specified Ray as a RayMonitor. |
|
| Method Summary | |
|---|---|
void |
addPosition(Position p)
Method to add a Position to the path. |
void |
clear()
Method to clear the RayPath of all points. |
void |
draw(java.awt.Graphics2D g)
Method to draw the component in Graphics2D
context. |
java.awt.geom.Rectangle2D |
getBounds()
Method to get the bounds of the object in the y/z plane This is called automatically from within Diagram2D. |
java.awt.Color |
getColour()
Methed to get the current Color of the of the ray |
Position |
getNext()
Get the next valid Point from the Raypath,
null if there are none. |
java.util.Vector<Position> |
getPath()
Method to get the actual path whis is a Vector
of Positions |
Position |
getPosition(int i)
Method of to get a point from the path |
double |
getWaveLength()
Method to get the wavelength |
void |
reset()
Method to reset the nextRay counter |
void |
setColour(java.awt.Color c)
Method to manually set the colour of the raypath. |
void |
setWaveLength(double lambda)
Method to set the wavelength. |
int |
size()
Method to get the size (number of points) in the current path. |
java.lang.String |
toString()
Default toString method to format the RayPath as a String containing the Ray positions. |
void |
update(Ray r)
Update Monitor method specified in RayMonitor
interface called automatrcally every
time position changes. |
| 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 |
|---|
protected java.util.Vector<Position> path
Vector
protected double waveLength
| Constructor Detail |
|---|
public RayPath()
public RayPath(Ray r)
RayPath and attach
it to a specified Ray as a RayMonitor.
The is the normal method of using this class and and the
Ray is traced the path will be automatically recorded.
r - the Ray| Method Detail |
|---|
public void reset()
public void setWaveLength(double lambda)
Colour.WavelengthColour(double)
lambda - the wavelengthpublic double getWaveLength()
double the wavelengthpublic java.awt.Color getColour()
Color the current ray Color.public void setColour(java.awt.Color c)
c - the ColorsetWaveLength(double)public int size()
int size of pathpublic void addPosition(Position p)
Position to the path.
Not normally called by the user, but automatically via
the update method
p - the Position to be added.update(optics.Ray)public Position getPosition(int i)
i - the point index
Point3d the path point.public java.util.Vector<Position> getPath()
Vector
of Positions
Vector the actual path.public Position getNext()
Raypath,
null if there are none.
Position next point on Raypathpublic java.lang.String toString()
toString in class java.lang.ObjectString the formatted Stringpublic void clear()
public void update(Ray r)
RayMonitor
interface called automatrcally every
time position changes.
update in interface RayMonitorr - the calling Ray.public java.awt.geom.Rectangle2D getBounds()
Diagram2D.
getBounds in interface Diagram2DComponentRectangle2D the bounding Rectanglepublic void draw(java.awt.Graphics2D g)
Graphics2D
context. This is called automatically from within
Diagram2D.
draw in interface Diagram2DComponentg - the Graphics2D context
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||