-
Notifications
You must be signed in to change notification settings - Fork 0
SIPL Algiplot
First of all an example of a main with a basic usage of Algiplot:
#include "Algiplot_HE.h"
void main() {
Plot test;
Plot test2;
Color_Palette CSET;
test.Define_2D_Plot(10, 10, 25,"Grid");
test.Add_2D_Point(2, 4,CSET.Blue);
test2.Define_3D_Plot(15, 15, 25, "No_Grid");
test2.Add_3D_Point(2, 2, 1, CSET.Red);
test.Save_Plot();
system("Algiplot_Savefile.jpg");
Currently algiplot allows you plot 2D and 3D Cartesian coordinate systems as well as adding points to your plot. the work with algiplot is done by using the class "Plot" , each object of class "Plot" contains data about a plot defined by user which can be modified at any moment and in any point at time from the very beginning you can export the plot to the project directory. It is important to remember that after creating a "Plot" object you need to call one of the definition methods, after one of the Plot Types are defined the methods associated with any other type will be ignored if called.
Examples of 2D and 3D ploting;
- 2D:
- 3D:
`void Define_3D_Plot(int const &x_axis_length, int const &y_axis_length, int const &Step, const char *mod);`
`void Define_2D_Plot(int const &x_axis_length, int const &y_axis_length, int const &Step ,const char *mod);`
`void Add_3D_Point(int const &x, int const &y, int const &z, pixel const &color);`
`void Add_2D_Point(int const &x, int const &y,pixel const &color);`
`void Save_Plot();`
- Creating A Plot Object:
Plot MyPlot
When creating a new plot object there is no need to pass any parameters in the constructor ,a Plot object will not be usable until one of the definition methods is called.
- Defining The Plot Object:
MyPlot.Define_2D_Plot(10,10,"Grid");
In the above example we initiate a 2D definition on the Plot object named "MyPlot" , the 2D definition method similarly to the 3D definition method requires you to pass as argument the x,y,(and z) if working in 3D, Axis Lengths ,and a C_string which contains one of 2 mod commands:
1)"Grid" 2)"No_Grid"
these are quit self explanatory ,depending on what mod is passed to definition methods ,the resulting plot will either be with a grid in the background or without a grid.
After defining the plot type on you objects ,you can now start adding points.
- Adding points to Cartesian Coordinate Plot
'MyPloy.Add_3D_Point(2,5,1,CSET.Red);`
the same instruction is valid for 2D plot point adding just without the z coordinate. The point adding method requires you to pass the coordinate values where the point should be drawn on the Cartesian coordinate system, and a color which will be set to the drawn point . In the Above example CSET is an object of type Color_Palette ,more information on how to work with colors in SIPL can be found in the Color_Palette tab in the wiki.
keep in mind that plotting points beyond loaded graph borders will result in an error .
- Saving The Plot
MyPlot.Save_Plot();
you can call the saving method in any time and in any position from the moment the plot type has been defined calling the saving method will create a .jpg image in the project directory named "Algiplot_Savefile".