Introduction
An undocumented C++ file to plot potential lines and 2D graphs as SVG files. The input format for 2D graphs is a vector. The input format for a potential line maps are XX[]
, YY[]
and ZZ[] = f(XX[i], YY[i])
.
I wrote the code to plot aerospace simulation results and other simulation results in half a day to speed up productivity and automate the documentation process.
The name of the x
and y
axis have to be rearranged, as they are simply being dropped somewhere onto the plot.
Implementation
To plot a vector<VAR> as graph, use the example below:
SVG_clearPlotBuffer();
list<VAR> function;
function.push_back(0); function.push_back(2); function.push_back(4); function.push_back(4);
SVG_appendPointListBufferAS2DPlot( function,
"TEST");
writeSVGPointListBufferAS2DPlot("test.svg", 0,0,0,
"Rubber Materials", "Elongation", "Stress [Pa]");
The output of the above code is:
Clear the temporary plot buffer by calling:
SVG_clearPlotBuffer();
Plot potential lines:
VAR XX[100]; VAR YY[100]; VAR ZZ[100];
Make sure the points have an equal distance to each other and that the indexes are arranged as followed:
3;6;9
2;5;8
1;4;7
Pseudo code to create valid input buffers:
for x to DIM x do
for y to DIM y do
SET XX[x+y*DIM(x)] = x;
SET YY[x+y*DIM(x)] = y;
SET ZZ[x+y*DIM(x)] = f(x,y);
END
END
To plot potential lines, call:
VAR pos[10] = {0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7,0.01,0.02};
XXYYZZArrays2SVGImage_potential_lines("test.svg",
10 ,
10 ,
XX,YY,ZZ,
"NAME",
"X-AXIX NAME",
"Y-AXIS NAME",
10 ,
pos );
An example results in:
Point of Interest
I wrote the code to create plots and speed up productivity.
History