optics
Class OpticsApplet

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byedu.davidson.tools.SApplet
                      extended byoptics.OpticsApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class OpticsApplet
extends SApplet

This applet simulates an optics bench containing lenses, mirrors, and sources.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.davidson.tools.SApplet
destroyed
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 int addAperture(double x, double openingSize)
          Add a blocking aperture at x.
 int addApertureP(int x, int openingSize)
          Add a blocking aperture at x.
 int addDielectric(double x, double dn, double r)
          Add a dielectric interface that can have a radius of curvature or none at all.
 int addDielectricP(int x, double dn, int r)
          Add a dielectric interface that can have a radius of curvature or none at all.
 int addIndexChange(double x, double delN)
          Add an index change that has no curvature.
 int addIndexChangeP(int x, double dn)
          Add an index change that has no curvature.
 int addISource(double x, double y, int size, double angle)
          Adds an infinite source with parallel rays.
 int addISourceP(int x, int y, int size, double angle)
          Adds an infinite source with parallel rays.
 int addLens(double x, double fl)
          Adds a thin lens, no spherical aberration, based on matrix transformations.
 int addLensP(int x, double fl)
          Adds a thin lens, no spherical aberration, based on matrix transformations.
 int addMirror(double x, double fl)
          Adds an ideal mirror, based on matrix transformations.
 int addMirrorP(int x, double fl)
          Adds an ideal mirror, based on matrix transformations.
 int addObject(java.lang.String name, java.lang.String parList)
          Create an object and add it to the Physlet.
 int addPSource(double x, double y)
          Adds an principal-ray source which draws the three principal rays.
 int addPSourceP(int x, int y)
          Adds an principal-ray source which draws the three principal rays.
 int addRefraction(double x, double delN, double r)
          Adds a refraction interface that can represent a thick lens with spherical aberration and internal reflection.
 int addRefractionP(int x, double delN, int rT)
          Adds a refraction interface that can represent a thick lens with spherical aberration and internal reflection.
 int addScreen(double x)
          Adds a screen.
 int addScreenP(int x)
          Adds a screen using pixel units.
 int addSource(double x, double y, double rayIncrement, double raySlope)
          Adds a regular point source, with spreading rays from a single point.
 int addSourceP(int x, int y, double rayIncrement, double raySlope)
          Adds a regular point source, with spreading rays from a single point.
 int addSphericalMirror(double x, double fl)
          Adds a spherical mirror.
 int addSphericalMirrorP(int x, double fl)
          Adds an spherical mirror.
 void clearAll()
          Clears all elements from bench and repaints
 void deleteActiveElement()
          Delete the active element from the applet.
 boolean deleteObject(int id)
          Delete an object from the applet.
 double getFocalLength(int id)
          Get the element's focal length
 double getIndex(int id)
          Get the element's index of refraction.
 double getX(int id)
          Get the element's x position.
 double getXPos(int id)
          Bug-fix to get the x of an object on Netscape and Sun.
 double getY(int id)
          Get the element's y position.
 double getYPos(int id)
          Bug-fix to get the y of an object on Netscape and Sun.
 int makeDataConnection(int sourceID, int listenerID, int seriesID, java.lang.String xStr, java.lang.String yStr)
          Have the applet make a new data connection.
 boolean set(int id, java.lang.String name, java.lang.String parList)
          Change the properies of an object.
 boolean setAnimationSlave(int masterID, int slaveID)
          Force an object to follow another object on the screen.
 void setAutoRefresh(boolean ar)
          Repaint every time the system parameters are changed.
 boolean setConstraint(int id, int constraintID)
          Set a motion constraint on an object.
 void setDefault()
          Calls the following methods: setPixPerUnit(100), setInfo(false), setSize(.8), setDrag(false), setPropertyDrag(false), & setDirection(1)
 void setDirection(int d)
          Set the direction that sources added after will start in
 boolean setDisplayOffset(int id, int xOff, int yOff)
          Offset the object's position on the screen from its default drawing position.
 void setDrag(boolean d)
          Determines if elements added after value is set will be allowed to be dragged
 boolean setDragable(int id, boolean drag)
          Change the drag property of a wire or loop after it has been created.
 void setElementRGB(int r, int g, int b)
          Set the color of lenses and mirrors. 0,0,0 will reset default.
 void setElementSize(double s)
          Bug-fix to set the size of the optic elements.
 void setInfo(boolean i)
          Determines if elements added after value will show information on screen including focal lengths and positions
 boolean setObjectFont(int id, java.lang.String family, int style, int size)
          Sets the object's font if the object has text that can be displayed.
 void setPixPerUnit(int ppu)
          Set the Pixels per Unit.
 void setPropertyDrag(boolean pd)
          Determines if elements added after value is set will be allowed to have their properties changed by dragging
 void setRayRGB(int r, int g, int b)
          Set the color of the source light rays.
 boolean setResizable(int id, boolean isResizable)
          Make an object resizable.
 boolean setRGB(int id, int r, int g, int b)
          Set the red, green, and blue color values for a wire or coil that has already been created.
 boolean setShowFocus(int id, boolean show)
          Change the showFocus property.
 void setSize(java.awt.Dimension d)
           
 void setSize(double s)
          Set the size of the optic elements.
 void setSize(int w, int h)
           
 boolean setVisibility(int id, boolean show)
          Show the visibility of the object.
 void setX(int id, double x)
          Set the element's x position.
 void setXPos(int id, double x)
          Set the element's x position.
 void setXY(int id, double x, double y)
          Set the element's x position.
 void setY(int id, double y)
          Set the element's y position.
 void setYPos(int id, double y)
          Set the element's y position.
 void updateDataConnection(int id)
          updateDataConnections();
 void updateDataConnections()
          updateDataConnections();
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, checkAppletNames, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, formatValue, forward, getAppletName, getClockID, getClockTime, getDataFromDS, getDataListener, getDataSource, getDataSource, getDebugLevel, getID, getSourceData, getSourceVariables, isClockRunning, isValidFunction, pause, removeDataListener, removeDataSource, reset, reverse, sendDataToListener, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setConnectionWindowX, setConnectionWindowY, setDebugLevel, setDt, setExternalClock, setFPS, setIndependentClock, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stop, stopClock
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setDisplayOffset

public boolean setDisplayOffset(int id,
                                int xOff,
                                int yOff)
Offset the object's position on the screen from its default drawing position.

Parameters:
id - The id of the object.
Returns:
True if successful.

clearAll

public void clearAll()
Clears all elements from bench and repaints


setDragable

public boolean setDragable(int id,
                           boolean drag)
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

setShowFocus

public boolean setShowFocus(int id,
                            boolean show)
Change the showFocus property. The focus of lenses and mirrors will be drawn as a white dot on the axis when the object is selected with a mouse click.

Parameters:
id - the object identifier
show - true to show the focus
Returns:
true if successful

setConstraint

public boolean setConstraint(int id,
                             int constraintID)
Set a motion constraint on an object.

Parameters:
id - the ID of the object.
constraintID - the ID of the constraint.
Returns:
true if successful.

setDrag

public void setDrag(boolean d)
Determines if elements added after value is set will be allowed to be dragged

Parameters:
d - True or False

setAnimationSlave

public boolean setAnimationSlave(int masterID,
                                 int slaveID)
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.

setResizable

public boolean setResizable(int id,
                            boolean isResizable)
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.
Returns:
true if successful.

setPropertyDrag

public void setPropertyDrag(boolean pd)
Determines if elements added after value is set will be allowed to have their properties changed by dragging

Parameters:
pd - True or False

setInfo

public void setInfo(boolean i)
Determines if elements added after value will show information on screen including focal lengths and positions

Parameters:
i - True or False

setElementRGB

public void setElementRGB(int r,
                          int g,
                          int b)
Set the color of lenses and mirrors. 0,0,0 will reset default.

Parameters:
r - 0g - 0b - 0

setObjectFont

public boolean setObjectFont(int id,
                             java.lang.String family,
                             int style,
                             int size)
Sets the object's font if the object has text that can be displayed. This method fails due to operator overloading on some browers. Use setObjectFont instead.

Parameters:
id - The id of the object.
family - The font family: Helvetica, Times.
style - The style, 0=plain, 1=bold.
size - The size of the font;
Returns:
true if successful.

setRayRGB

public void setRayRGB(int r,
                      int g,
                      int b)
Set the color of the source light rays.

Parameters:
r - 0g - 0b - 0

setRGB

public boolean setRGB(int id,
                      int r,
                      int g,
                      int b)
Set the red, green, and blue color values for a wire or coil that has already been created. Color values must be in the range 0..255.

Parameters:
id - The id for the wire or loop.
r - red.
g - green.
b - blue.

setSize

public void setSize(double s)
Set the size of the 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

setDirection

public void setDirection(int d)
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

setPixPerUnit

public void setPixPerUnit(int ppu)
Set the Pixels per Unit.

Parameters:
ppu - 100 pixels per unit is as if on the screen 100 pixels represents 1 meter

setAutoRefresh

public void setAutoRefresh(boolean ar)
Repaint every time the system parameters are changed.

Overrides:
setAutoRefresh in class SApplet
Parameters:
ar - Automatic repaint?

setDefault

public void setDefault()
Calls the following methods: setPixPerUnit(100), setInfo(false), setSize(.8), setDrag(false), setPropertyDrag(false), & setDirection(1)

Overrides:
setDefault in class SApplet

setVisibility

public boolean setVisibility(int id,
                             boolean show)
Show the visibility of the object.

Parameters:
show - true will show object on screen
Returns:
true if successful false otherwise

getFocalLength

public double getFocalLength(int id)
Get the element's focal length

Parameters:
id - The id of the element.
Returns:
double the focal length

getX

public double getX(int id)
Get the element's x position.

Parameters:
id - The id of the element.
Returns:
double the x position.

setX

public void setX(int id,
                 double x)
Set the element's x position.

Parameters:
id - the id of the element.
x - the x position.

setXY

public void setXY(int id,
                  double x,
                  double y)
Set the element's x position.

Parameters:
id - the id of the element.
x - the x position.

setXPos

public void setXPos(int id,
                    double x)
Set the element's x position.

Parameters:
id - the id of the element.
x - the x position.

setY

public void setY(int id,
                 double y)
Set the element's y position.

Parameters:
id - the id of the element.

setYPos

public void setYPos(int id,
                    double y)
Set the element's y position.

Parameters:
id - the id of the element.
y - the x position.

getY

public double getY(int id)
Get the element's y position.

Parameters:
id - The id of the element.
Returns:
double the y position.

getXPos

public double getXPos(int id)
Bug-fix to get the x of an object on Netscape and Sun.

Parameters:
id - The id of the object.
Returns:
true if successful

getYPos

public double getYPos(int id)
Bug-fix to get the y of an object on Netscape and Sun.

Parameters:
id - The id of the object.
Returns:
true if successful

setElementSize

public void setElementSize(double s)
Bug-fix to set the size of the 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

setSize

public void setSize(java.awt.Dimension d)

setSize

public void setSize(int w,
                    int h)

getIndex

public double getIndex(int id)
Get the element's index of refraction.

Parameters:
id - The id of the element.
Returns:
double the index

set

public boolean set(int id,
                   java.lang.String name,
                   java.lang.String parList)
Change the properies of an object. The first argument is the object identifier. The second argument is the name of the property and the third is a comma-delimited list of parameters. For example, the scale can be added a follows:

set(id, "lens", "x=3, f=-1");

Parameters:
id - the identifier of the object
name - the type of object to be set.
parList - a list of parameters
Returns:
true if successful

addObject

public int addObject(java.lang.String name,
                     java.lang.String parList)
Create an object and add it to the Physlet. The first argument is the name of the object to be added and the second is a comma-delimited list of parameters. For example, a circle can be added a follows:

addObject ("circle", "x = 0, y = -1.0, r = 10");

See the supplemental documentation for a list of object names and parameters.

Parameters:
name - the type of object to be created.
parList - a list of parameters to be set
Returns:
id that identifies the object.

deleteObject

public boolean deleteObject(int id)
Delete an object from the applet.

Parameters:
id - the object identifier
Returns:
true if successful

deleteActiveElement

public void deleteActiveElement()
Delete the active element from the applet.


makeDataConnection

public int makeDataConnection(int sourceID,
                              int listenerID,
                              int seriesID,
                              java.lang.String xStr,
                              java.lang.String yStr)
Have the applet make a new data connection.

Overrides:
makeDataConnection in class SApplet
Parameters:
sourceID - The id of the data source.
listenerID - The id of the data listener. This is usually an applet.
seriesID - The id of the series in the data listener.
xStr - The function of the data source variables to be plotted on the horizontal axis.
yStr -
Returns:
SDataConnection The hasCode id of the newly created data connection.

updateDataConnections

public void updateDataConnections()
updateDataConnections();

Overrides:
updateDataConnections in class SApplet

updateDataConnection

public void updateDataConnection(int id)
updateDataConnections();

Overrides:
updateDataConnection in class SApplet
Parameters:
id - The integer id of the data source.

addAperture

public int addAperture(double x,
                       double openingSize)
Add a blocking aperture at x. Alternative to addObject method.

Parameters:
x - The position of the aperture, in relative units specified by setPixPerUnit()
openingSize - 0<=openingSize<=1 \

addDielectric

public int addDielectric(double x,
                         double dn,
                         double r)
Add a dielectric interface that can have a radius of curvature or none at all. Uses small angle approximation that doesn't show aberration. This method is an alternative to the addObject method.

Parameters:
x - The position of the aperture, in relative units specified by setPixPerUnit
dn - Change in index of refraction from left to right.
r - The radius of curvature of the interface, in relative units.

addIndexChange

public int addIndexChange(double x,
                          double delN)
Add an index change that has no curvature. Uses Snell's law and can show total internal reflection. This method is an alternative to the addObject method.

Parameters:
x - The position of the aperture, in relative units specified by setPixPerUnit
delN - The change (+/-) of index going from left to right across interface

addRefraction

public int addRefraction(double x,
                         double delN,
                         double r)
Adds a refraction interface that can represent a thick lens with spherical aberration and internal reflection. Uses Snell's law, with angular displacement. This method is an alternative to the addObject method.

Parameters:
x - The x position of the refraction, in relative units specified by setPixPerUnit()
delN - The change in index of refraction when going from left to right across inferface
r - The radius of curvature of the interface, specified in relative units.

addISource

public int addISource(double x,
                      double y,
                      int size,
                      double angle)
Adds an infinite source with parallel rays. This method is an alternative to the addObject method.

Parameters:
x - The x position of the ISource, in relative units specified by setPixPerUnit
y - The x position of the ISource, in relative units specified by setPixPerUnit
size - The height from the top to bottom of the source, in pixels
angle - The slope of the rays, -1

addLens

public int addLens(double x,
                   double fl)
Adds a thin lens, no spherical aberration, based on matrix transformations. This method is an alternative to the addObject method.

Parameters:
x - The x position of the lens, in relative units specified by setPixPerUnit()
fl - The focal length of the lens, in relative units specified by setPixPerUnit()

addMirror

public int addMirror(double x,
                     double fl)
Adds an ideal mirror, based on matrix transformations. This method is an alternative to the addObject method.

Parameters:
x - The x position of the mirror, in relative units specified by setPixPerUnit()
fl - The focal length of the mirror, in relative units specified by setPixPerUnit()

addSphericalMirror

public int addSphericalMirror(double x,
                              double fl)
Adds a spherical mirror. Some aberations are calculated. This method is an alternative to the addObject method.

Parameters:
x - The x position of the mirror, in relative units specified by setPixPerUnit()
fl - The focal length of the mirror, in relative units specified by setPixPerUnit()

addPSource

public int addPSource(double x,
                      double y)
Adds an principal-ray source which draws the three principal rays. This method is an alternative to the addObject method.

Parameters:
x - The x position of the PSource, in relative units specified by setPixPerUnit()
y - The y position of the PSource, in relative units specified by setPixPerUnit()

addScreen

public int addScreen(double x)
Adds a screen. This method is an alternative to the addObject method.

Parameters:
x - The x position of the Screen, in relative units specified by setPixPerUnit()

addSource

public int addSource(double x,
                     double y,
                     double rayIncrement,
                     double raySlope)
Adds a regular point source, with spreading rays from a single point. This method is an alternative to the addObject method.

Parameters:
x - The x position of the Source, in relative units specified by setPixPerUnit()
y - The y position of the source, in relative units specified by setPixPerUnit()
rayIncrement - The delta slope between intervals of rays coming from the Source
raySlope - The starting slope of the outermost rays (top and bottom)

addApertureP

public int addApertureP(int x,
                        int openingSize)
Add a blocking aperture at x. Alternative to addObject method.

Parameters:
x - The position of the aperture, in direct pixel units
openingSize - 0<=openingSize<=1

addDielectricP

public int addDielectricP(int x,
                          double dn,
                          int r)
Add a dielectric interface that can have a radius of curvature or none at all. Uses the small angle approximation and therefore doesn't show aberration. This method is an alternative to the addObject method.

Parameters:
x - The position of the aperture, in pixel units
dn - Change in index of refraction from left to right.
r - The radius of curvature of the interface, in pixel units.

addIndexChangeP

public int addIndexChangeP(int x,
                           double dn)
Add an index change that has no curvature. Uses Snell's law and can show total internal reflection. This method is an alternative to the addObject method.

Parameters:
x - The position of the aperture, in pixel units
dn - The change (+/-) of index going from left to right across interface

addRefractionP

public int addRefractionP(int x,
                          double delN,
                          int rT)
Adds a refraction interface that can represent a thick lens with spherical aberration and internal reflection. Uses Snell's law, with angular displacement. This method is an alternative to the addObject method.

Parameters:
x - The x position of the refraction, in pixel units
delN - The change in index of refraction when going from left to right across inferface

addISourceP

public int addISourceP(int x,
                       int y,
                       int size,
                       double angle)
Adds an infinite source with parallel rays. This method is an alternative to the addObject method.

Parameters:
x - The x position of the ISource, in pixel units
y - The x position of the ISource, in pixel units
size - The height from the top to bottom of the source, in pixels
angle - The slope of the rays, -1

addLensP

public int addLensP(int x,
                    double fl)
Adds a thin lens, no spherical aberration, based on matrix transformations. This method is an alternative to the addObject method.

Parameters:
x - The x position of the lens, in pixel units
fl - The focal length of the lens, in pixel units

addMirrorP

public int addMirrorP(int x,
                      double fl)
Adds an ideal mirror, based on matrix transformations. This method is an alternative to the addObject method.

Parameters:
x - The x position of the mirror, in pixel units
fl - The focal length of the mirror, in pixel units

addSphericalMirrorP

public int addSphericalMirrorP(int x,
                               double fl)
Adds an spherical mirror. Not all aberations are calculated. This method is an alternative to the addObject method.

Parameters:
x - The x position of the mirror, in pixel units
fl - The focal length of the mirror, in pixel units

addPSourceP

public int addPSourceP(int x,
                       int y)
Adds an principal-ray source which draws the three principal rays. This method is an alternative to the addObject method.

Parameters:
x - The x position of the PSource, in pixel units
y - The y position of the PSource, in pixel units

addScreenP

public int addScreenP(int x)
Adds a screen using pixel units. This method is an alternative to the addObject method.

Parameters:
x - The x position of the Screen, in pixel units

addSourceP

public int addSourceP(int x,
                      int y,
                      double rayIncrement,
                      double raySlope)
Adds a regular point source, with spreading rays from a single point. This method is an alternative to the addObject method.

Parameters:
x - The x position of the Source, in pixel units
y - The y position of the source, in pixel units
rayIncrement - The delta slope between intervals of rays coming from the source, typical value is .25
raySlope - The starting slope of the outermost rays (top and bottom), typical value is between 0 and 1


Visit the Davidson College Physlet Site for additional information.