VBScript code excerpts

 

Sub CommandButton1_Click()
   n = 3  ' number of variables
   ncnlin = 0
.    .    .
' on the first call initialise the plotting area
   if (first_call = 1) then     
      GRAPH.BrushColor 230,240,255
      GRAPH.PenColor 0,0,0
      GRAPH.PenWidth = 3
      GRAPH.text "Rays that minimise the optical path integral",x_start, y_start+20
      GRAPH.Rectangle x_start,20,x_start+337,y_start
      GRAPH.circle 468,y_start,10 
      first_call = 0
   end if 
 ' set the bounds and constraints
        .  .  .
   atmospheric_factor = TextBox1.Value ' set the atmospheric decay factor
   if (atmospheric_factor <> "") then  ' check that the decay factor has been set
      ' perform the numerical optimisation
      OPTIM.optimise n, nclin, ncnlin, a(0), tda, g(0), loc_x(0), bl(0), bu(0)
      OPTIM.getvars loc_x(0), n ' load the optimal cubic coefficients into loc_x
      ' work out the optimal path of the ray
             .    .    .                                               
        do_plot() ' now  plot the optimal path
    end if
        .   .   .
End Sub
Previous slide Next slide