Tag Archive: harshal

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.


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.


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


ASH Graph Plotter


This was our(Harshal, Shaunak and Aakash(me)) first project in college during the course BE in Computer Science at MS University of Baroda. We were supposed to create something for the subject Object Oriented Programming during the III semester. The project show have all the features we learned theoretically like Abstraction, Encapsulation, friend functions, Inheritance etc. All of us met and started thinking about the project. We were only introduced to Turbo C++ and were supposed to develop in that, sadly that was the only tool/compiler we knew. So graphically we were limited to the DOS display capabilities.

We first came up with an idea to create a simulation of the Solar System, displaying rotation speeds and astronomical figures for the planets in it. For some time that was all we could think about. Then one day I don’t remember who but introduced the idea of a graph plotter. It clicked and all of us agreed to create one. We were all really exited to start but had no clue about the leads. We had UML and stuff but we never paid attention to it(frankly we all bunked classes ;)). So we started off by creating a grid by drawing lines of the DOS screen.


We then went on to create the necessary functions to evaluate a polynomial mathematically for different values of its variables. It was named polycal(). It made us really happy when the function worked. Then we tried plotting our first no-references-defined-random graph. I just couldn’t get it right even after trying for hours, then at around 4PM I found the bug. Sala ek variable ko galat value diya tha(the variable value was not proper). Then finally our first graph was visible and the nature of the graph was accurate enough to meet our expectations.


We then moved on towards the other functions namely Logarithmic, Exponential and Trigonometric. As we had already created the function to evaluate values of polynomial equations, ¬†plotting Exponential and Log functions was easy. The reason being we took functions of the form ‘log(polynomial)’ and ‘e^(polynomial)’. The problem we faced was of plotting huge values that crossed the boundaries of our graph(screen). So we designed an Autoscale function which would take in array of values and scale them down to permissible values. Soon after that Log function raised its hand asking as to how would it calculate log for -ve numbers. We addressed it by designing another function which will take in both the arrays for x and y values(y being empty). It will calculate the polynomial and if the result is negative then it will drop that particular value from the x array. I dont remember the name of the function but lets call it “Autodrop” for now.


Inspired by the CRO in our physics lab, I tried doing something more appealing graphically to our Graph plotter. So I designed a new look for our graph with proper boundaries, different colors and adding some animation to it. The new design looked great and all of us agreed to go with it. We displayed the scale and provided some navigation controls.

The only problem left was with the Trigonometric functions. The values our display could plot was integers and not floating point numbers. The trig values of sine and cosine being limited to [0,1] were not displayed appropriately on the graph. Then one night it just worked. Dividing by the number 6 was our answer, not 7 not 8 just 6. It is still a mystery to us.

All being said and done we added one more final touch of a splash screen inspired by the Footprints(college fest) posters designed by Nakul Purohit. On the last night we prepared the report got Prachi Jain’s 10 MP(big deals !!) at 10 in night, clicked the screenshots and had a good night’s sleep. The next day we submitted our project but the response was not as we expected(they missed our splash screen ūüė¶ ).But never mind we were satisfied !

Some screenshots of the final product :

Splash screen , Main Menu , Function Selection , Polynomial ,Sine , Log , Exponential , Cotangent