|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--java.applet.Applet | +--edu.davidson.tools.SApplet | +--eField4.EField
EField is part of the Davidson College Physlets project. EField plots electric fields given a potential function and/or point charges. Both fixed charges and moving test charges can be specified using "add" methods.
The following embedding parameters are defined:
Parameter | Value | Data Type | Description |
---|---|---|---|
FPS | 10 | double | Frames per second during animation. |
dt | 0.1 | double | Animation time step per frame. |
ShowControls | true | boolean | Show VCR buttons at bottom of applet. |
ShowContours | true | boolean | Show equipotential contours. |
ShowPoles | true | boolean | Show fixed charges. |
ShowLabels | true | boolean | Add labels to contour lines. |
ShowFieldLines | false | boolean | Draw field lines. Computationally EXPENSIVE |
ShowFieldVectors | true | boolean | Draw direction arrows to represent field. |
PointChargeMode | true | boolean | Select between point charge and line charge mode. Use 1/(r*r) dependence for fixed charge if true. Use 1/r dependence if false. |
PixPerUnit | 10 | double | Conversion from pixel units to world units. |
GridUnit | 1.0 | double | The grid spacing. A value of 0 will suppress the grid. |
Potential | 0 | string | The potential function, U(x,y). |
Range | -1,1,-1,1 | string | Approximate x and y coordinate range. X range takes precedence to insure 1:1 aspect ratio. MUST be a string: "-1,1,-1,1" |
GridSize | 64 | (Not Implemented.) |
Various objects in EField implement the data source interface. This interface, SDataSource, enables inter-applet data passing between Physlets.
Object | Identifier | Variables |
---|---|---|
Fixed Charges. | The id is returned when an object is created using an add
method. id=addCharge(double x, double y, double m) |
t, x, y, vx, vy, ax, ay, fx, fy, p, m, q Note: p is the potential and q is the magnitude of the charge. |
All shapes: circle, rectangle, box, etc. | The id is returned when an object is created using an add method. | t, x, y, vx, vy, ax, ay |
clock | id=getClockID() | t |
Methods to access the animation clock can be found in the superclass documentation, SApplet.
Fields inherited from class edu.davidson.tools.SApplet |
clock,
dataConnections,
dataListeners,
dataSources,
lock |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
EField()
|
Method Summary | |
int |
addObject(java.lang.String name,
java.lang.String parList)
Create an object and add it to the Physlet. |
void |
clearSeries(int s)
Clear the data from a graph series. |
void |
deleteCharges()
Deletes the fixed charges. |
void |
deleteDataConnection(int id)
Break the data connection identified by the id. |
void |
deleteDataConnections()
Break all data connections. |
void |
deleteObject(int id)
Delete an object from the applet. |
void |
deleteSeries(int s)
Delete a series from the graph |
void |
deleteTestCharges()
Deletes the test charges. |
void |
destroy()
|
void |
forward()
Resume the simulation with a positive time step. |
java.lang.String |
getAppletInfo()
|
int |
getGraphID()
Get the series ID for the graph object. |
java.lang.String |
getParameter(java.lang.String key,
java.lang.String def)
|
java.lang.String[][] |
getParameterInfo()
|
int |
getSeriesID(int sid)
Get the series ID, that is the hashcode, from a series number. |
double |
getTime()
Get the y velocity of an object. |
double |
getVX(int id)
Get the x velocity of an object. |
double |
getVY(int id)
Get the y velocity of an object. |
double |
getX(int id)
Get the x position of an object. |
double |
getY(int id)
Get the y position of an object. |
void |
init()
|
void |
jbInit()
|
int |
makeDataConnection(int sourceID,
int listenerID,
int seriesID,
java.lang.String xStr,
java.lang.String yStr)
Make a data connection between a data source, i.e. |
void |
pause()
Pause the simulation |
void |
reset()
Reset the initial conditions at time t=0. |
void |
reverse()
Resume the simulation with a negative time step. |
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 whenevers the system parameters are changed. |
void |
setBz(double bz)
Set the z component of the magnetic field. |
void |
setCaption(java.lang.String c)
Set the caption. |
void |
setChargeLabel(java.lang.String l)
Set the charge label. |
boolean |
setChargeMagnitude(int id,
double mag)
Set the magnitude for a charge. |
void |
setChargeRGB(int r,
int g,
int b)
Set the color for new charges. |
void |
setChargeTrail(int t)
Set the animation the default trail length. |
boolean |
setConstrainR(int id,
double r,
double x,
double y)
Constrain the motion of the test charges to a circular path. |
boolean |
setConstraintStr(int id,
java.lang.String str,
double xmin,
double xmax)
Constrain the motion of the test charges to a path given my F(x). |
boolean |
setConstrainX(int id,
double x,
double xmin,
double xmax)
Constrain the motion of the test charges to a path of constant x. |
boolean |
setConstrainY(int id,
double y,
double ymin,
double ymax)
Constrain the motion of the test charges to a path of constant y. |
boolean |
setDamping(int id,
double d)
Set the color for an object. |
void |
setDampOnMousePressed(boolean damp)
Set the velocity of an object to zero if it is being dragged. |
void |
setDefault()
Sets the default conditions. |
boolean |
setDisplayOffset(int id,
int xOff,
int yOff)
Offset the object's position on the screen from its default drawing position. |
void |
setDrag(boolean drag)
Set drag for all subsequently created charges. |
boolean |
setDragable(int id,
boolean drag)
Make the object with the given id dragable. |
void |
setFieldResolution(int r)
Set the field resolution determines how the spacing of the field vectors on the grid. |
boolean |
setFont(int id,
java.lang.String family,
int style,
int size)
change the object's font for any text that is displayed. |
boolean |
setFootPrints(int id,
int n)
Set the trail to leave footprints as the charge moves. |
boolean |
setFormat(int id,
java.lang.String fstr)
Change the object's format for the display of numeric data. |
boolean |
setGhost(int id,
boolean ghost)
Have the charge draw ghost images as it moves. |
void |
setGridSize(int n)
Set the grid size for the evaluation of the potential energy. |
void |
setHideCharge(boolean hc)
Hide all charges. |
boolean |
setLabel(int id,
java.lang.String label)
Make the object label. |
boolean |
setMass(int id,
double m)
Set the mass of an object. |
void |
setMaxTime(double max,
java.lang.String msg)
Stop the simulation at a predetermined time and display a message for the user. |
boolean |
setOnScreenSize(int id,
int size)
Set the size for an object. |
void |
setPointChargeMode(boolean pcm)
Set point charge to produce 1/(r*r) field. |
void |
setPotential(java.lang.String ps,
double xmin,
double xmax,
double ymin,
double ymax)
Set the potential function. |
boolean |
setRGB(int id,
int r,
int g,
int b)
Set the color for an object. |
void |
setSeriesRGB(int id,
int r,
int g,
int b)
Set the series line and marker color. |
void |
setSeriesStyle(int id,
boolean conPts,
int m)
Set the series style for the graoh object. |
void |
setShowCharge(boolean sc)
Display all fixed charges on the screen. |
void |
setShowConstraintPath(int id,
boolean sc)
Show a the constraint function that test particles must follow. |
void |
setShowContours(boolean sc)
Show the contour lines. |
void |
setShowCoordOnDrag(boolean sc)
Show the coordinates on a mouse drag. |
void |
setShowEOnDrag(boolean se)
Show the field at the mouse postion on a mouse drag. |
void |
setShowEquipotentialOnClick(boolean sp)
Draw equipotential starting at the mouse click. |
void |
setShowEquipotentialOnDoubleClick(boolean sp)
Draw equipotential starting at the mouse double click. |
boolean |
setShowFComponents(int id,
boolean sc)
Enable the charge force vector to show components when it is drawn. |
void |
setShowFieldLineOnClick(boolean sfl)
Draw a field line starting at the mouse click. |
void |
setShowFieldLineOnDoubleClick(boolean sfl)
Draw a field line starting at the mouse double click. |
void |
setShowFieldLines(boolean sfl)
Show the field lines. |
void |
setShowFieldVectors(boolean sfv)
Show the direction field vectors. |
boolean |
setShowFOnDrag(int id,
boolean sfm)
Enable the charge to show the force magnitude in the message box. |
void |
setShowForce(boolean sf)
Show the default to show the force vector on all subsequently created test charges. |
boolean |
setShowFVector(int id,
boolean sf)
Enable the charge to show the net force vector when it is drawn. |
void |
setShowLabels(boolean sl)
Show the contour labels. |
void |
setShowTime(boolean st)
Show the simulation time. |
boolean |
setShowVComponents(int id,
boolean svc)
Enable the charge velocity vector to show components when it is drawn. |
void |
setShowVelocity(boolean sv)
Show the default to show the velocity vector on newly created test charges. |
void |
setShowVOnDrag(boolean sv)
Show the potential at the mouse postion on a mouse drag. |
boolean |
setShowVVector(int id,
boolean sv)
Enable the charge to show the net velocity vector when it is drawn. |
boolean |
setSpeed(int id,
double speed)
Change the speed of a test charge. |
boolean |
setSticky(int id,
boolean isSticky)
Make the object stickey so that collisions stop the animation. |
void |
setTimeContinuous()
Let the simulation continue forever. |
void |
setTimeCycle(double max)
Cycle the simulation |
void |
setTimeOneShot(double max,
java.lang.String msg)
Run the simulaiton one time. |
void |
setTimeVisibility(boolean visible)
Enable the time display in the applet window. |
void |
setTolerance(double t)
Set the tolerance for the animation calculations. |
boolean |
setTrail(int id,
int pts)
Set the trail behind a charge. |
boolean |
setTrajectory(int id,
java.lang.String xStr,
java.lang.String yStr)
Set the trajectory of a pole. |
boolean |
setVisibility(int id,
boolean show)
Show the visibility of the object. |
void |
setXRange(double xmin,
double xmax)
Set the scale using the horizontal axis. |
boolean |
setXY(int id,
double x,
double y)
Set position of an object. |
void |
setYRange(double ymin,
double ymax)
|
void |
start()
|
void |
stepBack()
|
void |
stepForward()
|
void |
stepTimeBack()
Step the simulation one negative time step. |
void |
stepTimeForward()
Step the simulation one positive time step. |
void |
stop()
|
Methods inherited from class java.applet.Applet |
getAccessibleContext,
getAppletContext,
getAudioClip,
getAudioClip,
getCodeBase,
getDocumentBase,
getImage,
getImage,
getLocale,
getParameter,
isActive,
newAudioClip,
play,
play,
resize,
resize,
setStub,
showStatus |
Methods inherited from class java.awt.Panel |
addNotify |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getListeners,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paint,
paintComponents,
preferredSize,
print,
printComponents,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setCursor,
setFont,
setLayout,
update,
validate |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addHierarchyBoundsListener,
addHierarchyListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
contains,
contains,
createImage,
createImage,
disable,
dispatchEvent,
enable,
enable,
enableInputMethods,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getGraphicsConfiguration,
getHeight,
getInputContext,
getInputMethodRequests,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
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,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public EField()
Method Detail |
public java.lang.String getParameter(java.lang.String key, java.lang.String def)
public void init()
public void jbInit() throws java.lang.Exception
public void start()
public void stop()
public void destroy()
public final java.lang.String getAppletInfo()
public int getGraphID()
public int getSeriesID(int sid)
public void setSeriesStyle(int id, boolean conPts, int m)
id
- The series id.conPts
- Connect the points?m
- Marker style. (m=1 is cross; m=2 is square, m=3 is
circle)public void deleteSeries(int s)
Series
- IDpublic void clearSeries(int s)
Series
- IDpublic double getX(int id)
id
- The id of the object.public double getY(int id)
id
- The id of the object.public double getVX(int id)
id
- The id of the object.public double getVY(int id)
id
- The id of the object.public double getTime()
id
- The id of the object.public java.lang.String[][] getParameterInfo()
public int addObject(java.lang.String name, java.lang.String parList)
addObject ("circle", "x = 0, y = -1.0, r = 10");
name
- the type of object to be created.parList
- a list of parameters to be setpublic void deleteObject(int id)
id
- the object identifierpublic void deleteTestCharges()
public void deleteCharges()
public boolean setDamping(int id, double d)
id
- The ID of the object.d
- The damping coeficient in the rate equation.
F_damp=-damping*velocity.public void setDefault()
public void setXRange(double xmin, double xmax)
xmin
- Minimuum value on x axis.xmax
- Maximum value on x axis.public void setYRange(double ymin, double ymax)
public boolean setXY(int id, double x, double y)
id
- The ID of the object.x
- The x coordinate.y
- The y coordinate.public void setDrag(boolean drag)
drag
- Drag?public void setDampOnMousePressed(boolean damp)
damp
- the velocity?public boolean setDragable(int id, boolean drag)
id
- The id of the object.drag
- Dragable?public boolean setVisibility(int id, boolean show)
st
- show object on screen?public boolean setFont(int id, java.lang.String family, int style, int size)
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;public boolean setFormat(int id, java.lang.String fstr)
id
- The id of the object.fstr
- the format string.public boolean setFootPrints(int id, int n)
id
- The id of the object.n
- The number of points to skip between trail
footprints or ghost images.public void setHideCharge(boolean hc)
hc
- HidCharge parameter.public boolean setLabel(int id, java.lang.String label)
id
- The id of the object.label
- The label string.public void setShowFieldLines(boolean sfl)
sfl
- Show field line.public void setShowFieldVectors(boolean sfv)
sfv
- Show field line vectors.public void setShowContours(boolean sc)
sc
- Show contours.public void setPointChargeMode(boolean pcm)
pcm
- Set point charge modepublic void setShowLabels(boolean sl)
sl
- Show contour labels?public void setAutoRefresh(boolean ar)
autoRefresh
- Automatic repaint?public boolean setAnimationSlave(int masterID, int slaveID)
masterID
- The id of the master object.slaveID
- The id of the slave object.public boolean set(int id, java.lang.String name, java.lang.String parList)
set(id, "sale", "xmin=0, xmax=2, autoscalx=false");
id
- the identifier of the objectname
- the type of property to be created.parList
- a list of parameterspublic void setBz(double bz)
bz
- The magnetic field in the z directon.public void setCaption(java.lang.String c)
c
- The caption string.public void setChargeLabel(java.lang.String l)
l
- All subsequent charges will show this label in the
middle of the charge.public boolean setChargeMagnitude(int id, double mag)
id
- The ID of the object.mag
- The magnitude.public void setChargeRGB(int r, int g, int b)
r
- red.g
- green.b
- blue.public boolean setMass(int id, double m)
id
- The id of the object.m
- The new mass.public boolean setConstraintStr(int id, java.lang.String str, double xmin, double xmax)
str
- The function string F(x).xmin
- The minimum value of the range.xmax
- The maximum value of the range.public boolean setConstrainX(int id, double x, double xmin, double xmax)
x
- The x value.xmin
- The minimum value of the range.xmax
- The maximum value of the range.public boolean setConstrainR(int id, double r, double x, double y)
r
- The r value.x
- The x coordinate of the centery
- The y coordinate of the centerpublic boolean setConstrainY(int id, double y, double ymin, double ymax)
y
- The y value.ymin
- The minimum value of the range.ymax
- The maximum value of the range.public boolean setDisplayOffset(int id, int xOff, int yOff)
id
- The id of the object.xoff
- The x offset.yoff
- The y offset.public void setChargeTrail(int t)
t
- The default trail points to draw in the animation
behind a moving charge.public boolean setRGB(int id, int r, int g, int b)
id
- The ID of the object.r
- red.g
- green.b
- blue.public void setSeriesRGB(int id, int r, int g, int b)
id
- The series id.r
- red.g
- green.b
- blue.public boolean setOnScreenSize(int id, int size)
id
- The ID of the object.r
- red.g
- green.b
- blue.public int makeDataConnection(int sourceID, int listenerID, int seriesID, java.lang.String xStr, java.lang.String yStr)
sourceID
- The source ID.listenerID
- The listener ID.seriesID
- The listener ID series.xStr
- The ordinate to be passed to the data listener.yStr
- The abscissa to be passed to the data listener.public void deleteDataConnection(int id)
id
- The data connection id.public void deleteDataConnections()
public void setShowTime(boolean st)
st
- Show the time?public void setShowCoordOnDrag(boolean sc)
sc
- Show the coordinates.public void setShowVOnDrag(boolean sv)
sv
- Show the voltage?public void setShowEOnDrag(boolean se)
se
- Show the field.public void setShowEquipotentialOnClick(boolean sp)
sfl
- Enable field line on click.public void setShowEquipotentialOnDoubleClick(boolean sp)
sfl
- Enable field line on double click.public void setShowFieldLineOnClick(boolean sfl)
sfl
- Enable field line on click.public void setShowFieldLineOnDoubleClick(boolean sfl)
sfl
- Enable field line on double click.public void setShowConstraintPath(int id, boolean sc)
sc
- Show the path?public boolean setShowFComponents(int id, boolean sc)
id
- The ID of the charge.sc
- Show the vector?public boolean setShowFOnDrag(int id, boolean sfm)
id
- The ID of the charge.sfm
- Show the force magnitude?public boolean setShowFVector(int id, boolean sf)
id
- The ID of the charge.sf
- Show the vector?public void setFieldResolution(int r)
r
- the resolutionpublic void setGridSize(int n)
n
- the size of the gridpublic boolean setGhost(int id, boolean ghost)
id
- The id of the object.ghost
- Draw ghost?public void setShowForce(boolean sf)
sf
- Show the force?public void setShowVelocity(boolean sv)
sv
- Show the velocity?public boolean setShowVComponents(int id, boolean svc)
id
- The ID of the charge.svc
- Show the vector components?public boolean setShowVVector(int id, boolean sv)
id
- The ID of the charge.sv
- Show the velocity vector?public boolean setSticky(int id, boolean isSticky)
id
- The id of the object.stick
- Sticky?public boolean setSpeed(int id, double speed)
id
- The ID of the charge.speed
- Show new speed.public void setShowCharge(boolean sc)
sc
- Show the charges on the screen.public boolean setTrail(int id, int pts)
id
- The ID of the object.pts
- Trail length.public void setTimeVisibility(boolean visible)
boolean
- Show the time?public void setTimeContinuous()
public void setTimeCycle(double max)
max
- Reset the simulation to t=0 when t>=max and
repeat the simulation.public void setTimeOneShot(double max, java.lang.String msg)
max
- Reset the simulation to t=0 when t>=max and stop the simulation.string
- the message to be displayed on the screen when the max time is reached.public void setTolerance(double t)
public boolean setTrajectory(int id, java.lang.String xStr, java.lang.String yStr)
id
- The ID of the pole.xStr
- The function x(t).yStr
- The function y(t).public void setPotential(java.lang.String ps, double xmin, double xmax, double ymin, double ymax)
ps
- The potential function, f(x,y).xmin
- x minimumxmax
- x maximumymin
- approximate y minimumymax
- approximate y maximumpublic void setMaxTime(double max, java.lang.String msg)
max
- Stop the simulation when t=max and continue
simulation.msg
- Display a user message.public void pause()
public void forward()
public void reverse()
public void stepTimeForward()
public void stepForward()
public void stepTimeBack()
public void stepBack()
public void reset()
|
Copyright Wolfgang Christian | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |