Eureka – Plot your imaginations.

  • by asg_labsadmin
  • 0 comments

This was our project for the subject Java we studied in the IIIrd year of Engineering. We(Me, Harshal and Shaunak) decided to extend out previous version of graph plotter. Our aim was to make the GUI more pro, the plotting more accurate and include the necessary facilities like better scaling, saving graphs for future use and multiple graphs for simultaneous comparisons.

GridBag(Card(GridBag))

We started with designing a Layout for out project. We considered and analyzed the available options and finally decided to make a combination of GridBag Layout and Card Layout. According to the design the Main Screen will be based upon a GridBag layout. This was done to avoid positioning/shifting/alignment problems of the controls that were going to appear on the screen. The function selector was supposed to be on the left sidebar, and always visible. The function selector was based on Card Layout, which in turn had a GridBag Layout to support the controls inside each card. We added the feature for parsing the input polynomial so that the user need not follow an order as in he can enter constants and degree polynomials without concerning himself about the terms being sorted according to their power. P.S. The design was heavily inspired by Limewire 4 !!

MathCore – AutoScale 2.0 and Special Curves

After the design we worked on how we can make our graph plotter more precise and with better scaling. To make it more precise we had to overcome the problem of plotting floating points on the computer screen. After much thought we decided to divide our canvas into units and each unit in turn into 10 parts. So if we want to plot say 5.2 on any axis then it would be at 5 units and 2 parts. This method was extensible to as many decimal points as possible but due to our limited hardware and processing capabilities we limited it to 2 points.  The increase in the precision enabled us to create smoother curves. We were able to include graphs for parabola, ellipse, hyperbola and special curves like Limacon, Cardiod and Rose curves, and what curves baby !!

This being done we decided to enhance our scaling algorithm. This time we used 3 scaling factors – 2,3 and 5. We designed and coded an algorithm to determine which value will give us the best scaling considering the computed values and canvas size, and then use that number to scale our values. It also worked smoothly and our Core computing task was done.

GUI

Our design/layout was done, but it was not enough. We decided to include a multigraph feature ie the ability to plot multiple graphs on tabs in the same screen, as we have in our web browsers nowadays. We implemented a TabCtrl class and created tabs on the fly to minimize memory leaks. Each tab had its own Canvas class and would save its graph as long as it’s object is alive. We added menus and keyboard shortcuts to complete the GUI. The last feature we added was for saving the graph as a .jpg/.png… file ready for printing or saving for future reference.

Packaging and The Splash !

Finally we packaged the whole stuff in a neat way and separated the Core Math part from the GUI classes. But something was missing, you guessed it right-The Splash screen…Harshal created a great looking splash screen the night before with the fractals and the killer font Evanescent. The final run sure made us go Eureka !!

Some screenshots:

splash , sine , rose curves , polynomial , parabola , log , limacon , hyperbola, exponential, ellipse, cardiod

Let us know your thoughts: