Read Mode

Plot Function ver.1.0 by Kvc

#TheBATeam Wishes you a Happy and Innovative New Year (2016). We are back with another amazing plugin or Extension of Batch. It may not be useful for all of the Batch Programmers… As it is not that type of extension which you can use in any of your batch programs, ‘cuz it is purely Mathematics based Extension, But we’re sure that it’ll definitely amaze you…

You can use it in your batch programs where you need Graphical calculations or representation of data in the graphical form. E.g. Population changes in area, CPU Usage History, Mathematical analysis of any system etc. The Plugin (Code + algorithm) Is created by Kvc, enjoying his Christmas holidays from the studies.

We’ve implemented the mathematical techniques and methods to modify a system, those we’ve leant in our math’s classes (Special thanks to complex algebra Teacher). If you don’t know anything about batch and cmd console, then this plugin may seems to be foolish and easy to you, But in fact, we always got amaze by watching this type of complex output from a simple and dumb system like cmd console.

Plot function Ver.1.0 by kvc
First preview of Plot Function

The Plot function automatically detects the center of the current console and assumes it as the Origin (0,0). And then Plots the specified points against the origin. If this explanation seems simpler to you, then try opening cmd in your system and observe yourself about the properties of the console (cmd).

The Problem was that console plots at given x,y co-ordinates by taking top-left corner of the screen as origin… and this scenario is very much different than the real world situation, thus, to plot a point as we do in real world, We need to firstly shift the real origin of the console to the center and then adjust the given co-ordinates as per the real world situation.

Explanation by kvc
Diffrence between cmd and real world...

When this problem occurred, It seems too complex to us that we decided to leave this project and start with another one, But as I read somewhere that “Mathematics is the best tool humans have.” After a deep analysis of 2 hour, we made a successful algorithm and logic which can implement our requirements.

Now with the help of this new algorithm and logic, we can convert a simple thing into something intelligent.

Kvc's workbook
Notes before Making Plot function

We’ve got Inspiration for this project from our MATLAB classes, as it is totally command based software same as cmd, and it has a plot function, which can plot various points on a graph. So, we decided to make this plot function in the bare cmd environment and finally, it seems like we’ve partially succeed in achieving our goal.

Success is a Journey, Not a destination.

We’ve scanned some of the pages from our work-book, and we would like to share them with you… Don’t take Hand-writing too much seriously as we’ve got our own Unique Fonts. :D :D :D

Plot function's algorithm by kvc
Algorithm logic page-1

As you can see in the above image that the 5,5 co-ordinate of console is at different position than the usual position of the 5,5 co-ordinate on the real graph. That’s why, we’ve to take care of very complex things while shifting origin of console form top-=left corner to the center of the console.

The work-Book is full with our mad ideas, but only few of them results in good programs. We take random examples to make our work easy and correct; the next page {Image} will help you in understanding what we’re talking about…

Plot function's algorithm by kvc
Algorithm logic page-2

So, let’s talk about using this Plot function in your cmd programs…

The syntax of the command is very simple and easy to remember, that it basically needs only 4-5 parameters / arguments. The Following Image may help you…

plot help menu
Help Menu

Either you can specify all of the co-ordinates directly into the command, or save them firstly into a file and rename its extension as ‘.plot’. Then you can load all the co-ordinates directly into the console screen. The Layout of the Plot file is shown in the image below…

A standard Plot File
Plot File's Layout

The Lines after ‘#’ are Comments; therefore they have no effect on the real working of the plot file. While 2,2 3,3 … are the original co-ordinates, which will be responsible for the plotting of points on console.

Plot file usage
Loading from plot file

We’ve also given the 3 different Style options for displaying the graph; it depends on the User, which style they like… The following images will show you the 3 different styles…

Different graph styles
Style 0

Different graph styles
Style 1

Different graph styles
Style 2

The selection of the style is totally based on the type of application and scenario in which you gonna use this awesome batch plugin. So, finally after all this explanation, do give it a try to see its working… You can download it from link given below and analyze the example.bat file given with it, to learn more…

We hope that you’ll like our work… Do leave your precious response about this project through your comments…

Keep learning, keep sharing…
Be happy, Spread Happiness…


No comments:

Powered by Blogger.