@physletName|OpticsApplet @code|optics.OpticsApplet.class @archive|Optics4_.jar,STools4.jar @appletSize|400|300 @embedParam|b|showControls|false|show controls: @embedParam|i|PixPerUnit|100|The pixels per unit along the x axis: addObject|arrow #FF707D >>> tt >>> object with three principle rays, starting from its head at coordinates (x,y) >>> tt >>> Add arrow s|name|source|HIDDEN \$ .|d|x|0.3|x: .|d|y|0.5|y: addObject|point #FF707D >>> tt >>> point source with fan of rays starting at coordinates (x,y). The slope increment between rays is entered as 1/(n-1), n beeing the desired number of rays >>> tt >>> Add point s|name|source|HIDDEN \$ .|f|flag|point|HIDDEN .|d|x|0.6|x: .|d|y|0.2|y: .|d|inc||number of rays, enter 1/n-1: addObject|beam #FF707D >>> tt >>> parallel rays, starting at (x,y). The slope is entered as with slope >>> tt >>> Add beam s|name|source|HIDDEN \$ .|f|flag|infinite|HIDDEN .|d|x|1.0|x: .|d|y|0.5|y: .|i|s||beam size in pixels: .|d|slope||slope, enter tan(alpha): addObject|lens #FFDA92 >>> tt >>> lens with focal length f at position x.
The graphics is only symbolic: The calculation takes place at the middle line according to the Gaussian matrix formalism - Simulations represent physical theories! >>> tt >>> Add lens s|name|lens|HIDDEN \$ .|d|x|2.0|x: .|d|f|1|focal length: addObject|mirror #FFDA92 >>> tt >>> mirror with focal length f at position x. The graphics is only symbolic: The calculation takes place at the middle line according to the Gaussian matrix formalism - Simulations represent physical theories! Another algorithm shows spherical aberrations. >>> tt >>> Add mirror s|name|mirror|HIDDEN \$ .|d|x|3|x: .|d|f|1|focal length: .|f|flag|;spherical|choose "spherical" to show aberrations: addObject|aper #FFDA92 >>> tt >>> an aperture restricts the propagation of light rays at position x >>> tt >>> Add aperture s|name|aperture|HIDDEN \$ .|d|x|1.0|x: .|d|opening|0.2|Opening (as fraction 0-1): addObject|screen #FFDA92 >>> tt >>> a screen stops the propagation of light rays at position x (behaves like an aperture with opening 0) >>> tt >>> Add screen s|name|screen|HIDDEN \$ .|d|x|1.0|x: addObject|indchg #FFDA92 >>> tt >>> a vertical split at position x into two regions with different index of refraction (absolute difference dn from the left to the right)
Choose algorithm "dielectric" for refraction according to Snell's law or
algorithm "refraction" for a small angle approximation.
The separation line of the regions can be curved with radius r. >>> tt >>> Add index s|flag|dielectric;refraction|algorithm: \$ .|d|x|2.5|x: .|d|dn|0.4|index changes by dn: .|d|r||curvature r: addObject|mtx #FFDA92 >>> tt >>> Design your own optic element by specifying its transformation matrix.
You need to express the new height and angle of an influenced ray as a function of its initial height h and angle a.
For example:
height="h+0.2"
angle="a"
would shift any beam by 0.2 units

>>> tt >>> Add matrix s|name|matrix|HIDDEN \$ .|d|x|1.0|x: .|s|height||. Enter functions of height h and angle a of the incoming ray:
-> outgoing ray: height: .|s|angle||angle: addObject|shape #FFDA92 >>> tt >>> Geometric shapes without physical interaction.
Note: Shapes are invisibly black. You can use their ID to change their color with an appropriate command (see list).

1. box - a hollow rectangle, centre at (x,y)
specify: height and width in pixels (and thickness of border in pixels - but this feature doesn't work yet)
2. rectangle - a filled rectangle, centre at (x,y)
specify: height and width in pixels
3. shell - a hollow circle, centre at (x,y)
4. rectangle - a filled circle lower left corner at (x,y)
>>> tt >>> Add shape s|flag|rectangle;box;circle;shell|shape: \$ .|d|x|1.0|x: .|d|y|0.5|y: .|i|w||width: .|i|h||heigth: .|i|r||radius: .|i|s||border (n/a): addObject|txt #FFDA92 >>> tt >>> Displays a text string, starting below point (x,y),

If this text is set to follow the movements of an object - via setAnimationSlave() - an evaluated function of this object's parameter can be printed after the text.

>>> tt >>> Add text s|name|text|HIDDEN \$ .|d|x|1.0|At position x: .|d|y|-0.5|y: .|s|text|your text|
display text: .|s|calc||and/or calculate this function: addObject|img #FFDA92 >>> tt >>> Displays an image (gif/jpg/png) with upper left corner at (x,y),

The path to the image file must specify in respect to the directory of the applets jar-archives (e.g. "classes")

For instance, if there's a directory "images" in directory "classes" the path should read "images/xy.gif".
If these two directories were on the same level, it should rather be: "../images/xy.gif"
".." always addresses the parent directory

Safest is storing the image in the same directory as the jar-archives, so it is simply referred as "xy.gif" >>> tt >>> Add image s|name|image|HIDDEN \$ .|d|x|3.0|At position x: .|d|y|0.5|y: .|s|file|smile.gif|display image: addObject| #FFDA92 >>> tt >>> Moves the optic elements and the rays in into the foreground after having inserted other graphics. >>> tt >>> Bench foreground s|name|bench|HIDDEN \$ .|f|foo| |HIDDEN setDragable| #FFFF99 >>> tt >>> Change the drag property of a wire or loop after it has been created. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - the object identifier
drag - true if dragable
Returns:
true if successful >>> tt >>> make dragable o|id||This object: b|drag|true|will be dragable: setResizable| #FFFF99 >>> tt >>> Make an object resizable. A resizable object will usually change its physical properites. For example, a resizable lens will change
its focal length.

Parameters:
id - the object identifier.
resizable - property
Returns:
true if successful. >>> tt >>> make resizable o|id||This object: b|isResizable|true|will be resizable: setRGB| #FFFF99 >>> tt >>> Set the red, green, and blue color values for an object that has already been created.
color values must be in the range
0..255.

Parameters: r=red, g=green, b=blue
Use color tables of other software to determine these values or guess the additive light mixing:
For instance, yellow = red + green, so try (255,255,0)
brown is a dark red, thus (100,0,0) may work. >>> tt >>> object's color o|id||Paint this object: i|r|255|with intensities 0..255 for red: i|g|255|green: i|b|0|blue: setShowFocus| #FFFF99 >>> tt >>> The focus of lenses and mirrors will be drawn as a white dot on the axis.

Parameters:
id - the object identifier
show - true to show the focus
Returns:
true if successful >>> tt >>> focus visible o|id||The focus of this object: b|show|true|will be visible: setVisibility| #FFFF99 >>> tt >>> Show or hide an object.

Parameters:
show - true will show object on screen
Returns:
true if successful false otherwise >>> tt >>> object visible o|id||This object: b|show|false|will be visible: setDisplayOffset| #FFFF99 >>> tt >>> Offset the object's position on the screen from its default drawing position.

Parameters:
id - The id of the object.
xoff - The x offset.
yoff - The y offset.
Returns:
True if successful. >>> tt >>> draw with offset o|id||This object: i|xOff|10|will be drawn higher by: i|yOff|10|pixels and/or shifted to the right by: setAnimationSlave| #FFFF99 >>> tt >>> Force an object to follow another object on the screen.

Parameters:
masterID - The id of the master object.
slaveID - The id of the slave object.
Returns:
true if successful. >>> tt >>> make follow o|masterid||This object: o|slaveid||will follow this object: addObject|id #FFFF70 >>> tt >>> Specify a region to which other objects can be bound. Use its new ID in a separate setContraint() command to apply this restriction to an object. >>> tt >>> Constraint region s|name|constraint|HIDDEN \$ .|d|xmin||xmin: .|d|xmax||xmax: .|d|ymin||ymin: .|d|ymax||ymax: setConstraint| #FFFF70 >>> tt >>> Restrict the possible movements of an object to a region that is specified as a "constraint" in a separate command. >>> tt >>> restrict motion o|id||This object: o|constraintid||is restricted by this constraint (as defined below): setPropertyDrag| #CCFFCC >>> tt >>> Determines if elements added after value is set will be allowed to have their properties changed by dragging

Parameters:
pd - True or False >>> tt >>> all property drag b|pd|true|All elements created after will be dragable: setDirection| #CCFFCC >>> tt >>> Set the direction that sources added after will start in

Parameters:
d - d=1 or d=-1. d=1 is to the right. d=-1 is to the left >>> tt >>> beam direction i|d|-1|All sources added after emit in this direction (to the right 1/ left -1): setInfo| #CCFFCC >>> tt >>> Determines if elements added after value will show information on screen including focal lengths and positions

Parameters:
i - True or False >>> tt >>> all show info b|i|true|All elements added after show their position, focal length etc. setDrag| #CCFFCC >>> tt >>> Determines if elements added after value is set will be allowed to be dragged

Parameters:
d - True or False >>> tt >>> all dragable b|d|true|All elements added after will be dragable: setDefault| #CCFFCC >>> tt >>> Calls the following methods: setPixPerUnit(100), setInfo(false), setElementSize(.8), setDrag(false), setPropertyDrag(false), & setDirection(1) >>> tt >>> Default values setElementSize| #B3EFFF >>> tt >>> Set the size of all optic elements. Size=1 will make the height of the elements equal to the height of the applet.

Parameters:
s - Size in the range 0 to 1.0 >>> tt >>> object's size d|s|0.7|The size of all objects shall be this fraction of the applet's height: setRayRGB| #B3EFFF >>> tt >>> Set the color of the source light rays.
color values must be in the range
0..255.

Parameters: r=red, g=green, b=blue
Use color tables of other software to determine these values or guess the additive light mixing:
For instance, yellow = red + green, so try (255,255,0)
brown is a dark red, thus (100,0,0) may work. >>> tt >>> ray color i|r|255|Intensities 0..255 for color components - red: i|g|255|green: i|b|0|blue: setElementRGB| #B3EFFF >>> tt >>> Set the color of lenses and mirrors. 0,0,0 will reset default.

Parameters:
r - 0, g - 0, b - 0 >>> tt >>> lens/mirror color i|r|255|Lenses and mirrors are displayed in colors (0..255) - red: i|g|255|green: i|b|0|blue: setPixPerUnit| #B3EFFF >>> tt >>> Set the Pixels per Unit.

Parameters:
ppu - 100 pixels per unit is as if on the screen 100 pixels represents 1 meter >>> tt >>> Pixel per Unit i|ppu|100|a unit of length corresponds to this many pixels: setAutoRefresh| #B3EFFF >>> tt >>> Repaint every time the system parameters are changed.
Overrides: setAutoRefresh in class SApplet >>> tt >>> setAutoRefresh b|ar|true|Applet shall be repainted after every change of system parameters: getFocalLength|f #E9D3FF >>> tt >>> Get the element's focal length

The result - here stored in a variable - can be used in other JavaScript commands. >>> tt >>> get focal length o|id||Create a variable containing the focal length of this object: getIndex|n #E9D3FF >>> tt >>> Get the element's index of refraction

The result - here stored in a variable - can be used in other JavaScript commands. >>> tt >>> get index n o|id||Create a variable containing the index of refraction of this object: getXPos|x #E9D3FF >>> tt >>> Get the element's x position.

The result - here stored in a variable - can be used in other JavaScript commands. >>> tt >>> get x position o|id||Create a variable containing the x position of this object: getYPos|y #E9D3FF >>> tt >>> Get the element's y position.

The result - here stored in a variable - can be used in other JavaScript commands. >>> tt >>> get y position o|id||Create a variable containing the y position of this object: clearAll| #FFFFFF >>> tt >>> Clears all elements from bench and repaints >>> tt >>> Clear all