|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.physics.waves.optics.elements.OpticalElement
public abstract class OpticalElement
The OpticalElement class is an abstract class which implements the
standard behaviour of an optical element. Every element inherits from it.
OpticalElement
subclasses into an OpticalDevice object and to use an
OpticalCanvas object to display it.
OpticalDevice,
OpticalCanvas| Constructor Summary | |
|---|---|
OpticalElement()
Default constructor, puts the elements at (0, 0, 0). |
|
OpticalElement(double w)
|
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
|
void |
draw(java.awt.Graphics g)
Draws the element's symbol into a Graphics object. |
int |
drawRay(java.awt.Graphics g,
Ray r,
int index)
Draws a part of a Ray (a RayPoint) going through the element. |
abstract void |
drawSelf(java.awt.Graphics g)
Draws the element's symbol into a Graphics object. |
Double3Vector |
getAxis()
Gets the y and z coordinates of the optical axis. |
Double3Vector |
getCenter()
Gets the center of the element. |
Double3Vector |
getOffAxis()
Returns the off axis properties of the element in an Double3Vector. |
double |
getWidth()
Gets the width of the element. |
double |
getX()
Gets the x coordinate of the element. |
void |
moveAxis(double y,
double z)
Moves the element's optical axis along the y and z directions. |
void |
moveOffAxis(double y,
double z)
Moves the element along the y and z directions (NOT the optical axis). |
void |
moveOnAxis(double x)
Moves the element along the optical axis, i.e. along the x direction. |
void |
propagate(Ray r)
Propagates a Ray through the element. |
RayPoint |
propagateRayPoint(RayPoint r)
Called by Propagate. |
abstract void |
propagateRayPointSelf(RayPoint r)
This method implements the element's actual behaviour. |
void |
putAfter(OpticalElement e)
Aligns the element on the same axis as the element passed as a parameter and moves it on the x direction directly to the right of the element. |
void |
rearrange()
|
void |
setWidth(double width)
Sets the width of the element. |
void |
translateOrigin(RayPoint rp)
Translates the RayPoint in order to put the origin of its coordinates system
at the element's center. |
void |
translateOriginBack(RayPoint rp)
Translates the RayPoint back in order to restore the origin of its coordinates system. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OpticalElement()
public OpticalElement(double w)
| Method Detail |
|---|
public void rearrange()
public java.lang.Object clone()
clone in class java.lang.Object
public void moveAxis(double y,
double z)
OpticalDevice, because each element aligns itself
on the previous one.
y - the y coordinate of the optical axis.z - the z coordinate of the optical axis.public void moveOnAxis(double x)
OpticalDevice,
because elements stack next to each other.
x - the x coordinate of the element.
public void moveOffAxis(double y,
double z)
y - off-axis displacement along the y axis.z - off-axis displacement along the z axis.public double getX()
public Double3Vector getAxis()
Double3Vector with the y and z coordinates of the optical axis.
The x coordinate is set to 0.Double3Vectorpublic Double3Vector getOffAxis()
Double3Vector.
Coordinate x is set to 0.
Double3Vector with the y and z coordinates of the element centers
relative to the optical axis. The x coordinate is set to 0.Double3Vectorpublic void propagate(Ray r)
Ray through the element. The last RayPoint of
the Ray is sent to PropagateRayPoint and the result is
appended to the Ray.
r - the Ray to propagate. If it is not empty, its last
RayPoint is propagated through the element and the
resulting RayPoint is appended to its end.Ray,
RayPoint,
propagateRayPoint(org.jscience.physics.waves.optics.rays.RayPoint)public RayPoint propagateRayPoint(RayPoint r)
Propagate. Prepares the RayPoint before sending
it to PropagateRayPointSelf. Its existence validity are tested, and a
call to TranslateOrigin is made to adjust the RayPoint to
the element's local coordinates system. Then PropagateRayPointSelf is
called and eventually TranslateOriginBack to restore the coordinates system.
Note: This method should not be called by the user, nor overridden. One
should only call PropagateRay and override PropagateRayPointSelf.
r - the RayPoint to be propagated.
RayPoint, to be added to the end of the Ray.RayPoint,
propagate(org.jscience.physics.waves.optics.rays.Ray),
propagateRayPointSelf(org.jscience.physics.waves.optics.rays.RayPoint)public void translateOrigin(RayPoint rp)
RayPoint in order to put the origin of its coordinates system
at the element's center. The element's center is its center in directions y
and z, and its left side in direction x. Calls GetCenter for the center.
rp - the RayPoint to translate.translateOriginBack(org.jscience.physics.waves.optics.rays.RayPoint),
getCenter(),
RayPointpublic void translateOriginBack(RayPoint rp)
RayPoint back in order to restore the origin of its coordinates system.
Calls GetCenter for the center.
rp - the RayPoint to translate.translateOrigin(org.jscience.physics.waves.optics.rays.RayPoint),
getCenter(),
RayPointpublic Double3Vector getCenter()
TranslateOrigin,
TranslateOriginBack and Draw. Elements can override
this method to set the element's center to a point that is convenient to use
as the origin for propagation and/or drawing.
Double3Vector with the coordinates of the center.Double3Vector,
translateOrigin(org.jscience.physics.waves.optics.rays.RayPoint),
translateOriginBack(org.jscience.physics.waves.optics.rays.RayPoint),
draw(java.awt.Graphics)public abstract void propagateRayPointSelf(RayPoint r)
OpticalElement must override it. The RayPoint passes
as a parameter is non null, valid and a clone of the last RayPoint
of the Ray that was passed to Propagate.
PropagateRayPointSelf should move the RayPoint to the
last location where the element changes the wave vector (k), and set the wave
vector accordingly. The RayPoint's position is calculated relative to
the element's center, given by the result of the GetCenter method.
r - the RayPoint to propagate.RayPoint,
getCenter()public void draw(java.awt.Graphics g)
Graphics object. The
Graphics is translated in order to place the element's center
at the origin via a call to Graphics.translate, DrawSelf
is called, which performs the actual drawing, and another call to
Graphics.translate restores the Graphics origin.
This method should not be overridden except is special cases like in
OpticalDevice. Instead, DrawSelf must be overriden.
g - the Graphics object in which the element must be drawn.getCenter(),
drawSelf(java.awt.Graphics),
OpticalDevice.draw(java.awt.Graphics)public abstract void drawSelf(java.awt.Graphics g)
Graphics object. The origin is the
element's center, as defined by GetCenter. As it is abstract, every
subclass of OpticalElement must override this method.
g - the Graphics object in which the element must be drawn.
public int drawRay(java.awt.Graphics g,
Ray r,
int index)
Ray (a RayPoint) going through the element.
The Ray is drawn as a straight line connecting the previous element's
Raypoint with the current element's RayPoint in the
Ray. Elements that must draw Rays that propagate
differently (with multiple direction changes or elements like a index graded
optical fiber) should override this method.
g - the Graphics object in which the Ray
must be drawn.r - the Ray to draw.index - the index of the RayPoint to draw. Used to keep track of
the position in the Ray in case of multiple
OpticalDevice nesting.
RayPoint to be drawn by the next element.Ray,
RayPoint,
OpticalDevicepublic void putAfter(OpticalElement e)
e - the element on which to align the current element. The current
element will be place to its right.public double getWidth()
public void setWidth(double width)
width - the new width of the element.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||