Michael J.A. Clark
Michael Clark is a Computer Science student from England providing freelance programming and design when not studying at Cambridge. Skills: C#, Sitecore, PHP, XHTML, CSS, AS3, Java, ML, F#.

Sections

Contact details

Email
mjac@mjac.co.uk
Skype
mjacdotuk
Twitter
mjacuk

Ideas to improve my graph generator

I have decided to write a list of ideas to perfect my browser-based graph generator. Major changes:

Configurable resolution

The resolution of the plot window, amount of points calculated for each equation, should be easily configurable. At present equations based on t are only of resolution max(width, height) * 2 * Math.PI; I chose the value to plot any ellipse accurately however it is probably not the optimum general value. Some equations in terms of t, for instance the polar equation r = cos(100*x);, require far higher resolution to sufficiently analyse.

Cartesian equations in terms of x or y require no similar option as the application implements interpolation between these points to draw lines instead of dots.

Improved interpolation

The algorithm that turns points into lines is flawed. It should use lines centring on the point instead of at each extremity; put simpler, I am currently drawing a line from the last point up to the next and, instead of this, I should begin and end the line at the coordinate (x or y depending on the subject of the expression) f((x[n-1] + x[n]) / 2) and f((x[n] + x[n+1]) / 2); this will produce a truly accurate graph for Cartesian equations.

Minor discrepancies

  • At small screen resolutions the formula box for parametric equations is split so that the definition is on a separate line to the input box; non-breaking spaces should be used to prevent the variable definition covering more than one line
  • Add links to the permanent graph generator definition page on my homepage
  • More descriptive text and perhaps a help page for JavaScript commands (equation input)

Comments