Parabola Plotting Script

  • FeynmanLogomaker
    15th Apr 2013 Member 0 Permalink

    --Requires my graphics library
    function parabola(elemtype,x1,x2,scale)
    for x = x1, x2 do
    y = 380 - (math.abs(x - (x2 - (x2 - x1) / 2)) ^ 2) / scale -- Calculate the y value based on the x value
    if y < 0 then -- if y is out of bounds, set to 0
    y = 0
    end
    ftgl_line(elemtype,x,y,x,380) -- Draw a line from x,y to x,380
    end
    end

     Requires my graphics library to run.

     To run, type in console: parabola(element, start x, stop x, scale) - The scale is the curvature of the parabola. A higher scale makes a wider parabola.

  • jacob1
    15th Apr 2013 Developer 0 Permalink
    your graphics library thread is still locked though ... you should remove the cgi function from it so it can be unlocked.
  • FeynmanLogomaker
    15th Apr 2013 Member 0 Permalink

    Good idea...

     

    There, I got rid of it.