Curve Fitting Algorithms: FlashMX Demo Applet
     
 ---james w. bennett iii ( snowballs.chance@hell.com )
   


     UI notes :

  • place points by manually clicking anywhere inside the viewport area
  • to generate one of the four basic plot types, just place some points and click the appropriate button. To clear an existing plot (and ONLY that plot), just press the same button again (the button should read "clear [type]")
  • "reset plots" clears all current plots but leaves the data points alone
  • "reset all" removes all current plots and all existing data points from the viewport
  • "generate random pts" creates between 10 and 25 random points in the viewport. You'll be better able to see the applet's functionality, however, if you manually place data that conforms roughly to the type of curve fitting you'd like to test. I added this to save myself some time while I was coding the plotting methods, and thought I'd leave it in . . . just keep in mind that it isn't the best way to see what's going on
  • the "degree" comboBox sets the degree of the polynomial to be used for curve fitting. The UI allows degrees ranging from 3 to 10 (an arbitrary limitation), and the fitting method itself always limits the selected degree to NumberOfPoints - 1
  • the "polyline" plot is merely a connect-the-dots routine included as an aid in comparing a literal interpretation of the data with the other methods


       misc :

  • download the .fla, .swf and .as files for this project here
  • look at a couple of example screenshots in this MS Word document
  • e-mail me with comments or suggestions . . . I'd appreciate knowing that someone other than me has actually SEEN this stuff :)

    advanced drawing API function -- SPIRALS:

About a week ago I posted an addition to Ric Ewing's advanced drawing API functions, a method called drawSpiral().

  • the method accepts numerous arguments including:
    • starting _x and _y points
    • independent x and y-radii as well as an independent "growth rate" for each axis
    • start angle and the number of revolutions
    • direction of rotation can be reversed by using a negative value for 'revolutions'
  • download the .fla, .swf and .as files for this project here
  • I'd REALLY like to convert this method so that it uses 8 calls to curveTo() per revolution, instead of the current lineTo() solution you see above. The problem is that I could not figure out how to calculate the control points accurately. If anyone sees this and knows the answer, I'd LOVE to hear from you!!!!!!!!!