This is the web version of EJS interface
EJS version 4.3.3.3
  1. Author=Fu-Kwun Hwang - Dept. of Physics, National Taiwan Normal Univ.
  2. Abstract=hwang@phy.ntnu.edu.tw
  3. CaptureTools=true
  4. DataTools=true
  5. LanguageTools=true
  6. EmersionSupport=false
  7. AppletColSupport=false
  8. UseInterpreter=true
  9. AuxiliaryFiles=./twolens2_pkg/twolens2_zh.properties;

Intro Page

    NameValueTypeDimension
    NameValueTypeDimension
    NameValueTypeDimension
    NameValueTypeDimension

    FixRel Page

    if(nl){ sl=-1; sL="f1=-0.0"; shapeL=2; }else{ sl=1; sL="f1=0.0"; shapeL=1; } if(nr){ sr=-1; sR="f2=-0.0"; shapeR=2; }else{ sR="f2=0.0"; sr=1; shapeR=1; } p=x1-ox; q1=sl*f*p/(p-sl*f); M=-q1/p; dy1=-h/(n-1); dy3=M*dy1; ix=x1+q1; for(int i=0;i<n;i++){ rdy1[i]=i*dy1+h/2-oh2; rdy2[i]=-rdy1[i]-M*oh2-oh2; if(q1<0){ y1[i]=-oh2-rdy1[i]; rdy12[i]=-rdy2[i]/q1*(xmax*scale-x1); } } if(lens2on){ p2=x2-ix; q2=sr*f2*p2/(p2-sr*f2); M2=-q2/p2; ix2=x2+q2; clr=green2; ic=0; for(int i=0;i<n;i++){ rdy3[i]=-p2/q1*rdy2[i]; y3[i]=M*oh2+rdy3[i]; if(Math.abs(y3[i])<h2){ rdy4[i]=M*M2*oh2-y3[i]; }else{ ic++; rdy4[i]=q2/p2*rdy3[i]; } rdy5[i]=rdy4[i]/q2*(xmax*scale-x2); img2clr=new java.awt.Color(0,255,0,255-(int)(ic*200./n)); if(x2>ix2)rayclr=farnclr2; else rayclr=farnclr; } }else{ clr=green; } if(lens2on){ msgx=ix2; showreal=q2>0; }else{ msgx=ix; showreal=q1>0; }

    dvalue

    double dv; public double dvalue (double v) { if(v>0)dv=0.5; else if(v<0)dv=-0.5; else dv=0; return (int)(v*100+dv)/100.; }
    EJSVIEW: Click link to view it's content
    Control variables:(testing)
    double,double,double,double
    title="Frame"
    layout=border
    visible=true
    location="203,61"
    size="734,518"
    position=center
    layout=GRID:1,0,0,0
    position=center
    autoscaleX=false
    autoscaleY=false
    minimumX=xmin*scale
    maximumX=xmax*scale
    minimumY=ymin*scale
    maximumY=ymax*scale
    square=true
    background=DARKGRAY
    x=x1
    y=yc+0
    sizeX=w
    sizeY=h
    enabledPosition=false
    style=shapeL
    elementposition=CENTERED
    lineColor=CYAN
    fillColor=CYAN
    x=x1-w/1.2
    y=yc+0
    sizeX=w
    sizeY=h
    visible=nl
    enabledPosition=false
    style=ELLIPSE
    elementposition=CENTERED
    lineColor=DARKGRAY
    fillColor=DARKGRAY
    x=x1+w/1.2
    y=yc+0
    sizeX=w
    sizeY=h
    visible=nl
    enabledPosition=false
    style=ELLIPSE
    elementposition=CENTERED
    lineColor=DARKGRAY
    fillColor=DARKGRAY
    x=x2
    y=yc
    sizeX=scale*(xmax-xmin)
    sizeY=ymax-ymin
    style=RECTANGLE
    elementposition=WEST
    lineColor=64,64,64,192
    fillColor=64,64,64,192
    x=x2
    y=yc+0
    sizeX=w
    sizeY=h
    visible=lens2on
    style=shapeR
    elementposition=CENTERED
    lineColor=CYAN
    fillColor=CYAN
    x=x2-w/1.2
    y=yc+0
    sizeX=w
    sizeY=h
    visible=lens2on &&nr
    style=ELLIPSE
    lineColor=DARKGRAY
    fillColor=DARKGRAY
    x=x2+w/1.2
    y=yc+0
    sizeX=w
    sizeY=h
    visible=lens2on &&nr
    style=ELLIPSE
    elementposition=CENTERED
    lineColor=DARKGRAY
    fillColor=DARKGRAY
    numberOfElements=n
    x=ix
    y=yc+M*oh2
    sizeX=-q1
    sizeY=rdy2
    lineColor=200,220,208,128
    x=ox
    y=yc+0
    sizeX=0+0
    sizeY=oh
    enabledPosition=true
    enabledSize=true
    dragAction=if(ox>x1-size)ox=x1-size;
    lineColor=BLUE
    fillColor=BLUE
    lineWidth=stroke
    x=xmin*scale
    y=yc
    sizeX=(xmax-xmin)*scale
    sizeY=0
    x=ix
    y=yc
    sizeX=0
    sizeY=M*oh
    lineColor=clr
    fillColor=clr
    lineWidth=stroke
    numberOfElements=n
    x=ox
    y=yc+oh2
    sizeX=p
    sizeY=rdy1
    lineColor=200,220,208,128
    numberOfElements=n
    x=ix
    y=M*oh2
    sizeX=x2-ix
    sizeY=rdy3
    visible=lens2on && x2>ix
    lineColor=200,220,208,128
    numberOfElements=n
    x=x2
    y=y3
    sizeX=q2
    sizeY=rdy4
    visible=lens2on
    lineColor=rayclr
    numberOfElements=n
    x=x2
    y=y3
    sizeX=scale*xmax-x2
    sizeY=rdy5
    visible=lens2on
    lineColor=200,220,208,128
    x=xfL1
    y=yc+0
    sizeX=psize
    sizeY=psize
    pixelSize=true
    enabledPosition=true
    dragAction=if(xfL1>x1-fmin)xfL1=x1-fmin; f=x1-xfL1; xfR1=x1+f;
    lineColor=CYAN
    fillColor=CYAN
    x=xfR1
    y=yc+0
    sizeX=psize
    sizeY=psize
    pixelSize=true
    enabledPosition=true
    dragAction=if(xfR1<x1+fmin)xfR1=x1+fmin; f=xfR1-x1; xfL1=x1-f;
    lineColor=CYAN
    fillColor=CYAN
    x=xfL2
    y=yc+0
    sizeX=psize
    sizeY=psize
    pixelSize=true
    visible=lens2on
    enabledPosition=true
    dragAction=if(xfL2>x2-fmin)xfL2=x2-fmin; f2=x2-xfL2; xfR2=x2+f2;
    lineColor=CYAN
    fillColor=CYAN
    x=x1
    y=yc+0
    sizeX=psize
    sizeY=psize
    pixelSize=true
    enabledPosition=true
    dragAction=if(x1+fmin>x2)x1=x2-fmin;
    lineColor=RED
    fillColor=RED
    x=xfR2
    y=yc+0
    sizeX=psize
    sizeY=psize
    pixelSize=true
    visible=lens2on
    enabledPosition=true
    dragAction=if(xfR2<x2+fmin)xfR2=x2+fmin; f2=xfR2-x2; xfL2=x2-f2;
    lineColor=CYAN
    fillColor=CYAN
    x=x1+0
    y=h2
    sizeX=psize
    sizeY=psize
    pixelSize=true
    enabledPosition=true
    dragAction=h=h2*2;
    lineColor=MAGENTA
    fillColor=MAGENTA
    x=x2
    y=yc+0
    sizeX=psize
    sizeY=psize
    pixelSize=true
    visible=lens2on
    enabledPosition=lens2on
    dragAction=if(x2<x1+fmin)x2=x1+fmin; xfL2=x2-f2; xfR2=x2+f2;
    lineColor=RED
    fillColor=RED
    x=ix2
    y=yc
    sizeX=0
    sizeY=M*M2*oh
    visible=lens2on
    lineColor=img2clr
    fillColor=img2clr
    lineWidth=stroke
    numberOfElements=n
    x=x1
    y=y1
    sizeX=xmax*scale-x1
    sizeY=rdy12
    visible=q1<0 &&!lens2on
    lineColor=200,220,208,128
    x=ox+0
    y=oh2
    sizeX=psize
    sizeY=psize
    pixelSize=true
    enabledPosition=true
    dragAction=if(oh2<0)oh2=0; else if(oh2>oh)oh2=oh;
    lineColor=CYAN
    fillColor=CYAN
    x=ix2
    y=M*M2*oh2
    sizeX=psize
    sizeY=psize
    pixelSize=true
    visible=lens2on
    lineColor=CYAN
    fillColor=CYAN
    x=msgx
    y=msgy
    pixelSize=true
    visible=showreal
    text="real image"
    font=Monospaced,PLAIN,16
    lineColor=YELLOW
    fillColor=YELLOW
    x=msgx
    y=msgy
    pixelSize=true
    visible=!showreal
    text="virtual image"
    font=Monospaced,PLAIN,16
    lineColor=YELLOW
    fillColor=YELLOW
    position=south
    layout=border
    position=west
    layout=HBOX
    visible=false
    borderType=LOWERED_ETCHED
    text="init"
    enabled=_isPaused()
    action=_initialize()
    variable=_isPaused
    imageOn=/org/opensourcephysics/resources/controls/images/play.gif
    actionOn=_play()
    imageOff=/org/opensourcephysics/resources/controls/images/pause.gif
    actionOff=_pause()
    position=center
    layout=GRID:0,1,0,0
    layout=GRID:1,0,0,0
    variable=p
    minimum=size
    maximum=xmax
    format="p1=0.0"
    dragaction=ox=x1-p;
    variable=q1
    minimum=xmin
    maximum=xmax
    format="q1=0.0"
    layout=border
    position=west
    variable=nl
    text="concave"
    position=center
    variable=f
    minimum=fmin
    maximum=xmax
    format=%sL%
    dragaction=xfL1=x1-f; xfR1=x1+f;
    layout=GRID:1,0,0,0
    visible=lens2on
    variable=p2
    minimum=0
    maximum=xmax
    format="p2=0.0"
    variable=q2
    minimum=xmin
    maximum=xmax
    format="q2=0.0"
    layout=border
    position=west
    variable=nr
    selected=false
    text="concave"
    position=center
    variable=f2
    minimum=fmin
    maximum=xmax
    format=%sR%
    dragaction=xfR2=x2+f2; xfL2=x2-f2;
    position=east
    layout=GRID:0,1,0,0
    image=/org/opensourcephysics/resources/controls/images/reset.gif
    action=_reset()
    variable=lens2on
    text="2nd Lens"
    position=east
    variable=scale
    minimum=1.0
    maximum=10.0
    orientation=VERTICAL