@physletName|BField @code|bfield.BField.class @archive|BField4_.jar,STools4.jar @appletSize|400|300 @scriptHeader|setAutoRefresh(false); @scriptFooter|setAutoRefresh(true); @embedParam|b|ShowControls|false|show controls: @embedParam|s|Range|-5,5,-5,5|Range in units (use commas: "xmin,xmax,ymin,ymax") @embedParam|i|GridSize|32|grid size: addObject|wire #FF707D >>> tt >>> Add a straight wire perpendicular to the screen. Specify: x - position of the center in world units y - position of the center in world units i - the current in the wire. Positive currents flow out of the screen. >>> tt >>> Add wire s|name|wire|HIDDEN $ .|d|x|0|x: .|d|y|0|y: .|d|i|1|current: addObject|coil #FF707D >>> tt >>> Add a single circular conducting loop perpendicular to the screen. Specify: x - position of the center in world units (see range in applet parameters) y - position of the center in world units r - the radius of the wire in world units i - the current in the wire. Positive currents flow out of the screen. >>> tt >>> Add coil s|name|coil|HIDDEN $ .|d|x|1|x: .|d|y|0|y: .|i|r|1.5|r (units): .|d|i|1|current: addObject|cmp #FF707D >>> tt >>> Add a compass. Specify: x - position of the center in world units y - position of the center in world units r - the radius of the compass in pixels >>> tt >>> Add compass s|name|compass|HIDDEN $ .|d|x|2|x: .|d|y|2|y: .|i|r|30|r (pixels): addObject|shp #FFDA92 >>> tt >>> Insert a shape and use their generated names "shp.." to change their properties with other commands
>>> tt >>>
Add shape
s|type|circle;rectangle;shell;box;cursor|shape:
$
.|d|x|1.0|x:
.|d|y|0.0|y:
.|i|w||width:
.|i|h||heigth:
.|i|r||radius:
addObject|arr
#FFDA92
>>> tt >>>
Arrows are often animation slaves of other objects.
>>> tt >>>
Add arrow
s|name|arrow|HIDDEN
$
.|d|x|1|x:
.|d|y|1|y:
.|s|h|1|horizontal:
.|s|v|1|vertical:
addObject|txt
#FFDA92
>>> tt >>>
Add a text
x- double x position of the left side of the text in world units
y- double y position of the top of the text in world units
text- string static text.
calc- string An analytic function to be evaluated. The calculation is displayed to the right of the static text.
Text objects are often slaved to other objects. If a text object is slaved to an object, it takes on the properties of that object. In this Physlet, a slaved text object can evaluate a function of t, x, y, bx, by, i, curl, and path.
Note: The curl of the field is evaluated at the position, (x, y). The path is the line integral evaluated along the perimeter of a shell or a box object.
Note: To change the decimal format of the calculation use the setFormat method with the generated txt-variable as object.
>>> tt >>>
Add text
s|name|text|HIDDEN
$
.|d|x|0|x:
.|d|y|0.5|y:
.|s|text|your text|text:
.|s|calc||calculate:
addObject|id
#FFDA92
>>> tt >>>
An image file.
>>> tt >>>
Add image
s|name|image|HIDDEN
$
.|d|x|3.0|x:
.|d|y|0.5|y:
.|s|file|smile.gif|file:
addObject|cap
#FFDA92
>>> tt >>>
A caption is text that is centered near the top of the screen. Specify:
x- double x position of the center in world units
y- double y position of the center in world units
text- string text of the caption
Use the generated cap-Variable as object for "change color"
>>> tt >>>
Title
s|name|caption|HIDDEN
$
.|d|x|1.0|x:
.|d|y|-0.5|y:
.|s|text|your title|text:
setDragable|
#FFFF99
>>> tt >>>
Make an object relocatable with the mouse. Use the id (variable) 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|is 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|is resizable:
setVisibility|
#FFFF99
>>> tt >>>
Makes an object visible or invisible. The object is not destroyed; it is hidden and can be made visible at any time.
>>> tt >>>
Show/Hide
o|id||This object
b|show|false|is visible:
setAnimationSlave|
#FFFF99
>>> tt >>>
Combine a master object and a slave object so that the slave follows the master.
Slave could be a text - often in combination with a "display offset" for the text (see below)
>>> tt >>>
Animation Slave
o|masterID||master object:
o|slaveID||following object:
addObject|constr
#FFFF70
>>> tt >>>
Specify a region to which other objects can be bound. Then use the newly generated ID "constr.." in a 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.
This region must previously be specified as a "constraint" in a separate command.
>>> tt >>>
restrict motion
o|id||This object
o|constraintid||is restricted by this constraint (as defined above):
setShowFieldVectors|
#CCFFCC
>>> tt >>>
Show the direction field.
>>> tt >>>
Display field vectors
b|sfv|true|show field vectors:
setShowFieldLineOnDblClick|
#CCFFCC
>>> tt >>>
Enable the user to double click in order to draw a magnetic field line.
>>> tt >>>
Field line doubleclick
b|sfl|true|show a field line on double click:
setShowFVector|
#CCFFCC
>>> tt >>>
Enable a wire to show the net force vector acting on it.
>>> tt >>>
Show F vector
o|id||This object
b|showForce|true|shows a force vector:
setShowBOnDrag|
#CCFFCC
>>> tt >>>
Enable a the user to read the magnetic field magnitude by click-dragging the mouse.
>>> tt >>>
Display B
b|sb|true|Show B value on drag:
setShowCoordOnDrag|
#CCFFCC
>>> tt >>>
Enable a the user to read coordinates by click-dragging the mouse.
>>> tt >>>
Display x,y
b|sc|true|Mouse coordinates are displayed:
setShowForce|
#CCFFCC
>>> tt >>>
Show the absolute value of the force of a dragable object (in yellow box, behind the coordinates). Default: true
>>> tt >>>
Display F
o|id||This object
b|showForce|false|displays its force value:
setShowInfo|
#CCFFCC
>>> tt >>>
Enable a dragable object to show information such as the current on drag
>>> tt >>>
Display info
o|id||This object
b|showInfo|true|displays info on drag:
setSketchMode|id
#CCFFCC
>>> tt >>>
Enable sketching with the mouse.
>>> tt >>>
Sketch mode
b|sketch|true|Users can draw sketches with mouse in applet:
setDisplayOffset|
#B3EFFF
>>> tt >>>
Offset the object's position on the screen from its default drawing
position.
>>> tt >>>
Display offset
o|id||For This object
i|xOff|20|xo:
i|yOff|20|yo:
swapZOrder|
#B3EFFF
>>> tt >>>
Swap the drawing order on the screen.
>>> tt >>>
Foreground/ Background
o|id1||This object:
o|id2||swaps z-order with this object:
setObjectFont|
#B3EFFF
>>> tt >>>
change the object's font for any text that is displayed.
>>> tt >>>
Object font
o|id||For this text object:
s|family||font family:
i|style|20|style:
i|size|20|size:
setRGB|
#B3EFFF
>>> tt >>>
Set the red, green, and blue color values for a wire or coil that has already been created.
>>> tt >>>
Color
o|id||This object
i|r|20|has color components r:
i|g|20|g:
i|b|20|b:
getBx|bx
#E9D3FF
>>> tt >>>
Get the x component of the B field at a point.
>>> tt >>>
Get Bx
d|x|1.0|x:
d|y|1.0|y:
getBy|by
#E9D3FF
>>> tt >>>
Get the y component of the B field at a point.
>>> tt >>>
Get By
d|x|1.0|x:
d|y|1.0|y:
setCurrent|
#FF707D
>>> tt >>>
Change the current of a wire or loop after it has been created.
This can be performed by sliders.
>>> tt >>>
Set I
o|id||This object
d|c|1.0|has current I:
setBFunctions|
#FF707D
>>> tt >>>
Set an external magnetic field in a rectangular array
>>> tt >>>
Set B
s|bx||Bx(x,y):
s|by||By(x,y):
d|xmin|1.0|xmin:
d|xmax|1.0|xmax:
d|ymin|1.0|ymin:
d|ymax|1.0|ymax:
setRadius|
#FF707D
>>> tt >>>
Change the radius (in world units) of a loop after it has been created.
>>> tt >>>
Set r
o|id||This object
d|r|1.0|has radius r:
setXY|
#FF707D
>>> tt >>>
Set position of an object.
>>> tt >>>
Set x,y
o|id||This object
d|x|1.0|has coordinates x:
d|y|1.0|y:
reset|
#FFFFFF
>>> tt >>>
Reset the applet and clear the field lines.
>>> tt >>>
Reset
setDefault|
#FFFFFF
>>> tt >>>
Clear all the wires and coils and set the applet into a predefined state.
>>> tt >>>
set default