23#include "../maths/parser_functions.hpp"
24#include "../../kernel.hpp"
35static bool isPlot1D(
const std::string& sCommand)
37 return sCommand ==
"plot" || sCommand ==
"graph";
40static bool isPlot3D(
const std::string& sCommand)
42 return sCommand ==
"plot3d" || sCommand ==
"graph3d";
45static bool isMesh2D(
const std::string& sCommand)
47 return sCommand ==
"implot"
48 || (sCommand.substr(sCommand.length()-2) !=
"3d"
49 && (sCommand.substr(0, 4) ==
"mesh"
50 || sCommand.substr(0, 4) ==
"surf"
51 || sCommand.substr(0, 4) ==
"dens"
52 || sCommand.substr(0, 4) ==
"cont"
53 || sCommand.substr(0, 4) ==
"grad"));
56static bool isMesh3D(
const std::string& sCommand)
58 return sCommand.substr(sCommand.length()-2) ==
"3d"
59 && (sCommand.substr(0, 4) ==
"mesh"
60 || sCommand.substr(0, 4) ==
"surf"
61 || sCommand.substr(0, 4) ==
"dens"
62 || sCommand.substr(0, 4) ==
"cont"
63 || sCommand.substr(0, 4) ==
"grad");
66static bool isVect2D(
const std::string& sCommand)
68 return sCommand ==
"vect" || sCommand ==
"vector";
71static bool isVect3D(
const std::string& sCommand)
73 return sCommand ==
"vect3d" || sCommand ==
"vector3d";
76static bool isDraw(
const std::string& sCommand)
78 return sCommand ==
"draw" || sCommand ==
"draw3d";
83 return sCommand ==
"draw3d"
86 || sCommand.substr(0, 4) ==
"mesh"
87 || sCommand.substr(0, 4) ==
"surf"
88 || sCommand.substr(0, 4) ==
"cont";
93#define APPR_ONE 0.9999999
94#define APPR_TWO 1.9999999
95#define STYLES_COUNT 20
115 Plot graph(sCmd, _data, _parser, _option, _functions, _pData);
159 if (_mData.GetNy() > 1)
161 mglData _temp(_mData.GetNx()*2, _mData.GetNy());
163 for (
int j = 0; j < _mData.GetNy(); j++)
165 for (
int i = 0; i < _mData.GetNx(); i++)
167 _temp.a[2*i + j*_temp.GetNx()] = _mData.a[i+j*_mData.GetNx()];
168 _temp.a[2*i+1+j*_temp.GetNx()] = _mData.a[i+j*_mData.GetNx()];
176 mglData _temp(_mData.GetNN()*2);
178 for (
int i = 0; i < _mData.GetNx(); i++)
180 _temp.a[2*i] = _mData.a[i];
181 _temp.a[2*i+1] = _mData.a[i];
199static void writeTiff(mglGraph* _graph,
const string& sOutputName)
201 const unsigned char* bb = _graph->GetRGB();
202 int w = _graph->GetWidth();
203 int h = _graph->GetHeight();
204 unsigned char *tmp = (
unsigned char*)malloc(3*w*h);
205 memcpy(tmp, bb, 3*w*h);
206 wxImage tiffimage(w, h, tmp);
208 tiffimage.SaveFile(sOutputName, wxBITMAP_TYPE_TIF);
227 : _data(__data), _parser(__parser), _option(__option), _functions(__functions), _pData(__pData)
244 bool bAnimateVar =
false;
247 vector<string> vPlotCompose;
248 unsigned int nMultiplots[2] = {0, 0};
250 unsigned int nSubPlots = 0;
251 unsigned int nSubPlotMap = 0;
278 nMultiplots[1] = (
unsigned int)
intCast(v[0]);
279 nMultiplots[0] = (
unsigned int)
intCast(v[1]);
284 sCmd.erase(0, sCmd.find(
"<<COMPOSE>>") + 11);
288 sCmd.insert(0,
"subplot <<COMPOSE>> ");
295 while (sCmd.length())
304 vPlotCompose.push_back(sCmd.substr(0, sCmd.find(
"<<COMPOSE>>")));
305 sCmd.erase(0, sCmd.find(
"<<COMPOSE>>") + 11);
310 for (
unsigned int i = 0; i < vPlotCompose.size(); i++)
312 if (vPlotCompose[i].find(
"-set") != string::npos
313 && !
isInQuotes(vPlotCompose[i], vPlotCompose[i].find(
"-set"))
314 &&
findCommand(vPlotCompose[i]).sString !=
"subplot")
316 else if (vPlotCompose[i].find(
"--") != string::npos
317 && !
isInQuotes(vPlotCompose[i], vPlotCompose[i].find(
"--"))
318 &&
findCommand(vPlotCompose[i]).sString !=
"subplot")
346 vPlotCompose.push_back(sCmd);
360 size_t nPlotStart = 0;
365 while (nPlotStart < vPlotCompose.size())
369 if (vPlotCompose.size() > 1 && nMultiplots[0])
377 for (
unsigned int i = nPlotStart; i < vPlotCompose.size(); i++)
380 if (
findCommand(vPlotCompose[i]).sString ==
"subplot")
383 if (vPlotCompose[i].find(
"-set") != string::npos
384 && !
isInQuotes(vPlotCompose[i], vPlotCompose[i].find(
"-set")))
386 else if (vPlotCompose[i].find(
"--") != string::npos
387 && !
isInQuotes(vPlotCompose[i], vPlotCompose[i].find(
"--")))
408 nPlotStart =
createSubPlotSet(bAnimateVar, vPlotCompose, nPlotStart, nMultiplots, nSubPlots, nSubPlotMap);
411 if (nPlotStart < vPlotCompose.size())
413 _graph->SetFunc(
"",
"",
"");
414 _graph->SetOrigin(NAN, NAN, NAN);
477 if ((sPlotCommand.substr(0, 4) ==
"mesh"
478 || sPlotCommand.substr(0, 4) ==
"surf"
479 || sPlotCommand.substr(0, 4) ==
"cont"
480 || sPlotCommand.substr(0, 4) ==
"vect"
481 || sPlotCommand.substr(0, 4) ==
"dens"
482 || sPlotCommand.substr(0, 4) ==
"draw"
483 || sPlotCommand.substr(0, 4) ==
"grad"
484 || sPlotCommand.substr(0, 4) ==
"plot")
485 && sPlotCommand.find(
"3d") != string::npos)
489 else if (sPlotCommand.substr(0, 4) ==
"mesh" || sPlotCommand.substr(0, 4) ==
"surf" || sPlotCommand.substr(0, 4) ==
"cont")
493 else if (sPlotCommand.substr(0, 4) ==
"vect" || sPlotCommand.substr(0, 4) ==
"dens" || sPlotCommand.substr(0, 4) ==
"grad" || sPlotCommand ==
"implot")
515size_t Plot::createSubPlotSet(
bool& bAnimateVar, vector<string>& vPlotCompose,
size_t nSubPlotStart,
size_t nMultiplots[2],
size_t& nSubPlots,
size_t& nSubPlotMap)
517 vector<string> vDrawVector;
519 bool bNewSubPlot = nSubPlotStart != 0;
531 for (
unsigned int nPlotCompose = nSubPlotStart; nPlotCompose < vPlotCompose.size(); nPlotCompose++)
534 sCmd = vPlotCompose[nPlotCompose];
566 if (sCmd.find(
"-set") != string::npos && !
isInQuotes(sCmd, sCmd.find(
"-set")))
568 else if (sCmd.find(
"--") != string::npos && !
isInQuotes(sCmd, sCmd.find(
"--")))
577 if (
sFunc.find(
"??") != string::npos)
593 if (vPlotCompose.size() > 1)
644 filename(vPlotCompose.size(), nPlotCompose);
661 if (
findCommand(sCmd).sString ==
"subplot" && nMultiplots[0] && nMultiplots[1])
670 return nPlotCompose+1;
681 && (nPlotCompose == nSubPlotStart)
697 return vPlotCompose.size();
705 if (
sFunc.find(
"??") != string::npos)
712 std::vector<std::string> vDataPlots;
720 for (std::string sDataPlots : vDataPlots)
788 while (
sFunc.length())
793 if (!sArgument.length())
800 vDrawVector.push_back(sArgument);
830 createPlotOrAnimation(nPlotCompose, vPlotCompose.size(), bNewSubPlot, bAnimateVar, vDrawVector, vDataPlots);
842 return vPlotCompose.size();
904 _graph->SetFlagAdv(1, MGL_FULL_CURV);
929bool Plot::createPlotOrAnimation(
size_t nPlotCompose,
size_t nPlotComposeSize,
bool bNewSubPlot,
bool bAnimateVar, vector<string>& vDrawVector,
const vector<string>& vDataPlots)
931 mglData _mBackground;
998 _graph->SetRotatedText(
false);
1020 if (!nPlotCompose || bNewSubPlot)
1040 _mBackground.Minimal(), _mBackground.Maximal());
1104 string sConvLegends =
"";
1105 bool useImag =
false;
1109 mglData _mPlotAxes[2];
1127 int nDataOffset = 0;
1143 if (isComplexPlaneMode)
1151 else if (isComplexPlaneMode)
1157 if (!
plot2d(_mData, _mData2, _mPlotAxes, _mContVec))
1170 _graph->Cont(_mPlotAxes[0], _mPlotAxes[1], _mData,
1173 _graph->Cont(_mPlotAxes[0], _mPlotAxes[1], _mData,
1180 sConvLegends = useImag ?
"Im(" + sConvLegends +
")" :
"Re(" + sConvLegends +
")";
1182 sConvLegends =
"\"" + sConvLegends +
"\"";
1184 if (sConvLegends !=
"\"\"")
1217 _graph->Legend(1.35, 1.2);
1233bool Plot::plot2d(mglData& _mData, mglData& _mData2, mglData* _mAxisVals, mglData& _mContVec)
1276 _graph->Cont(_mContVec, _mAxisVals[0], _mAxisVals[1], _mData,
"_k");
1284 _graph->Cont(_mContVec, _mAxisVals[0], _mAxisVals[1], _mData,
"k");
1320 _graph->SetTicksVal(
'c',
"");
1322 _graph->Cont(_mContVec, _mAxisVals[0], _mAxisVals[1], _mData,
"kw");
1334 _graph->SetCutBox(mglPoint(0), mglPoint(0));
1342 _graph->Cont(_mContVec, _mAxisVals[0], _mAxisVals[1], _mData,
"_k");
1345 _graph->Cont(_mContVec, _mAxisVals[0], _mAxisVals[1], _mData,
"_k");
1391 string sConvLegends =
"";
1392 bool useImag =
false;
1399 int nPrevDataLayers = 0;
1400 int nCurrentStyle = 0;
1407 int nDataOffset = 0;
1422 _mData2[0].Link(useImag || isCplxPlaneMode ?
m_manager.
assets[n+nDataOffset+1].data[0].second :
m_manager.
assets[n+nDataOffset+1].data[0].first);
1424 _mData2[0] = 0.0 * _mData;
1429 if (
m_manager.
assets[n+nDataOffset].boundAxes.find(
'r') != std::string::npos)
1442 for (
size_t col = 0; col <
m_manager.
assets[n+nDataOffset].getLayers()+1; col++)
1446 _mData2[0].a[col] = nPrevDataLayers + 0.5 + col;
1468 _mData2[0] = 0.0 * _mData;
1481 _mData2[
XCOORD] = 0.0 * _mData;
1486 _mData2[
YCOORD] = 0.0 * _mData;
1492 if (
m_manager.
assets[n+nDataOffset].boundAxes.find(
't') != std::string::npos)
1494 for (
int i = 0; i <
getNN(_mPlotAxes); i++)
1497 _mPlotAxes.a[i] = NAN;
1504 for (
int i = 0; i <
getNN(_mPlotAxes); i++)
1507 _mPlotAxes.a[i] = NAN;
1511 if (
m_manager.
assets[n+nDataOffset].boundAxes.find(
'r') != std::string::npos)
1549 while (sConvLegends.length())
1552 string sLegend = sConvLegends.substr(0, sConvLegends.find(
'\n'));
1554 if (sConvLegends.find(
'\n') != string::npos)
1555 sConvLegends.erase(0, sConvLegends.find(
'\n')+1);
1557 sConvLegends.clear();
1560 sLegend = useImag ?
"Im(" + sLegend +
")" :
"Re(" + sLegend +
")";
1563 sLegend =
"\"" + sLegend +
"\"";
1566 if (sLegend !=
"\"\"")
1568 std::string sLegendStyle;
1634 if (!line.sDesc.length())
1638 double ypos = line.dPos + 0.01 * AutoRangeY;
1646 if (!line.sDesc.length())
1649 mglPoint textpos = mglPoint(line.dPos - 0.01 * AutoRangeX,
1651 mglPoint textdir = mglPoint(line.dPos - 0.01 * AutoRangeX,
1675bool Plot::plotstd(mglData& _mData, mglData& _mAxisVals, mglData _mData2[2],
const short nType)
1677#warning NOTE (numere#3#08/15/21): Temporary fix for MathGL misbehaviour
1698 _graph->Region(_mAxisVals, _mData, _mData2[0],
1700 _graph->Plot(_mAxisVals, _mData,
1702 _graph->Plot(_mAxisVals, _mData2[0],
1706 _graph->Area(_mAxisVals, _mData,
1714 _graph->BoxPlot(_mData2[0], _mData,
1721 _graph->Bars(_mAxisVals, _mData,
1725 _graph->Region(_mAxisVals, _mData, _mData2[0],
1727 _graph->Plot(_mAxisVals, _mData,
1729 _graph->Plot(_mAxisVals, _mData2[0],
1733 _graph->Area(_mAxisVals, _mData,
1736 _graph->Step(_mAxisVals, _mData,
1739 _graph->Plot(_mAxisVals, _mData,
1746 _graph->Bars(_mAxisVals, _mData,
1749 _graph->Step(_mAxisVals, _mData,
1752 _graph->Area(_mAxisVals, _mData,
1755 _graph->Plot(_mAxisVals, _mData,
1762 _graph->Bars(_mAxisVals, _mData,
1765 _graph->Barh(_mAxisVals, _mData,
1768 _graph->Step(_mAxisVals, _mData,
1771 _graph->Stem(_mAxisVals, _mData,
1774 _graph->Plot(_mAxisVals, _mData,
1779 _graph->Error(_mAxisVals, _mData, _mData2[0], _mData2[1],
1796 static const std::string slicesStyleChars[3] = {
"x",
"",
"z"};
1800 mglData _mContVec(15);
1810 for (
int nCont = 0; nCont < 15; nCont++)
1812 _mContVec.a[nCont] = dataInterval[0](nCont, 15).
real();
1815 _mContVec.a[7] = dataInterval[0].middle();
1908 _graph->ContF3(_mContVec,
1920 (
"k" + slicesStyleChars[i]).c_str(),
2022 _graph->SetCutBox(mglPoint(0), mglPoint(0));
2110 _graph->SetCutBox(mglPoint(0), mglPoint(0));
2124 mglData* _mData_x =
nullptr;
2125 mglData* _mData_y =
nullptr;
2173 string sCurrentDrawingFunction;
2176 for (
unsigned int v = 0; v < vDrawVector.size(); v++)
2181 sCurrentDrawingFunction = vDrawVector[v];
2184 for (
int n = (
int)sCurrentDrawingFunction.length() - 1; n >= 0; n--)
2186 if (sCurrentDrawingFunction[n] ==
',' && !
isInQuotes(sCurrentDrawingFunction, (
unsigned)n,
true))
2188 sStyle = sCurrentDrawingFunction.substr(n + 1);
2189 sCurrentDrawingFunction.erase(n);
2194 sStyle = sStyle.substr(0, sStyle.rfind(
')')) +
" -nq";
2199 for (
int n = (
int)sCurrentDrawingFunction.length() - 1; n >= 0; n--)
2201 if (sCurrentDrawingFunction[n] ==
',' && !
isInQuotes(sCurrentDrawingFunction, (
unsigned)n,
true))
2203 sTextString = sCurrentDrawingFunction.substr(n + 1);
2204 sCurrentDrawingFunction.erase(n);
2209 sTextString +=
" -nq";
2212 if (sCurrentDrawingFunction.back() ==
')')
2213 sDrawExpr = sCurrentDrawingFunction.substr(sCurrentDrawingFunction.find(
'(') + 1, sCurrentDrawingFunction.rfind(
')') - sCurrentDrawingFunction.find(
'(') - 1);
2215 sDrawExpr = sCurrentDrawingFunction.substr(sCurrentDrawingFunction.find(
'(') + 1);
2216 if (sDrawExpr.find(
'{') != string::npos)
2220 std::vector<double> vResults =
real({vRes, vRes+nFunctions});
2222 if (sCurrentDrawingFunction.substr(0, 6) ==
"trace(" || sCurrentDrawingFunction.substr(0, 5) ==
"line(")
2227 _graph->Line(mglPoint(), mglPoint(vResults[0], vResults[1]), sStyle.c_str());
2229 _graph->Line(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2], vResults[3]), sStyle.c_str());
2231 else if (sCurrentDrawingFunction.substr(0, 7) ==
"tracev(" || sCurrentDrawingFunction.substr(0, 6) ==
"linev(")
2236 _graph->Line(mglPoint(), mglPoint(vResults[0], vResults[1]), sStyle.c_str());
2238 _graph->Line(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[0] + vResults[2], vResults[1] + vResults[3]), sStyle.c_str());
2240 else if (sCurrentDrawingFunction.substr(0, 5) ==
"face(" || sCurrentDrawingFunction.substr(0, 7) ==
"cuboid(")
2245 _graph->Face(mglPoint(vResults[2] - vResults[3] + vResults[1], vResults[3] + vResults[2] - vResults[0]),
2246 mglPoint(vResults[2], vResults[3]),
2247 mglPoint(vResults[0] - vResults[3] + vResults[1], vResults[1] + vResults[2] - vResults[0]),
2248 mglPoint(vResults[0], vResults[1]),
2250 else if (nFunctions < 8)
2251 _graph->Face(mglPoint(vResults[4], vResults[5]),
2252 mglPoint(vResults[2], vResults[3]),
2253 mglPoint(vResults[0] + vResults[4] - vResults[2], vResults[1] + vResults[5] - vResults[3]),
2254 mglPoint(vResults[0], vResults[1]),
2257 _graph->Face(mglPoint(vResults[4], vResults[5]),
2258 mglPoint(vResults[2], vResults[3]),
2259 mglPoint(vResults[6], vResults[7]),
2260 mglPoint(vResults[0], vResults[1]),
2263 else if (sCurrentDrawingFunction.substr(0, 6) ==
"facev(")
2268 _graph->Face(mglPoint(vResults[0] + vResults[2] - vResults[3], vResults[1] + vResults[3] + vResults[2]),
2269 mglPoint(vResults[0] + vResults[2], vResults[1] + vResults[3]),
2270 mglPoint(vResults[0] - vResults[3], vResults[1] + vResults[2]),
2271 mglPoint(vResults[0], vResults[1]),
2273 else if (nFunctions < 8)
2274 _graph->Face(mglPoint(vResults[0] + vResults[4] + vResults[2], vResults[1] + vResults[3] + vResults[5]),
2275 mglPoint(vResults[0] + vResults[2], vResults[1] + vResults[3]),
2276 mglPoint(vResults[0] + vResults[4], vResults[1] + vResults[5]),
2277 mglPoint(vResults[0], vResults[1]),
2280 _graph->Face(mglPoint(vResults[0] + vResults[4], vResults[1] + vResults[5]),
2281 mglPoint(vResults[0] + vResults[2], vResults[1] + vResults[3]),
2282 mglPoint(vResults[0] + vResults[6], vResults[1] + vResults[7]),
2283 mglPoint(vResults[0], vResults[1]),
2286 else if (sCurrentDrawingFunction.substr(0, 9) ==
"triangle(")
2290 double c = hypot(vResults[2] - vResults[0], vResults[3] - vResults[1]) / 2.0 * sqrt(3) / hypot(vResults[2], vResults[3]);
2292 _graph->Face(mglPoint((-vResults[0] + vResults[2]) / 2.0 - c * vResults[3], (-vResults[1] + vResults[3]) / 2.0 + c * vResults[2]),
2293 mglPoint(vResults[2], vResults[3]),
2294 mglPoint((-vResults[0] + vResults[2]) / 2.0 - c * vResults[3], (-vResults[1] + vResults[3]) / 2.0 + c * vResults[2]),
2295 mglPoint(vResults[0], vResults[1]),
2298 _graph->Face(mglPoint(vResults[4], vResults[5]),
2299 mglPoint(vResults[2], vResults[3]),
2300 mglPoint(vResults[4], vResults[5]),
2301 mglPoint(vResults[0], vResults[1]),
2304 else if (sCurrentDrawingFunction.substr(0, 10) ==
"trianglev(")
2308 double c = sqrt(3.0) / 2.0;
2310 _graph->Face(mglPoint((vResults[0] + 0.5 * vResults[2]) - c * vResults[3], (vResults[1] + 0.5 * vResults[3]) + c * vResults[2]),
2311 mglPoint(vResults[0] + vResults[2], vResults[1] + vResults[3]),
2312 mglPoint((vResults[0] + 0.5 * vResults[2]) - c * vResults[3], (vResults[1] + 0.5 * vResults[3]) + c * vResults[2]),
2313 mglPoint(vResults[0], vResults[1]),
2316 _graph->Face(mglPoint(vResults[0] + vResults[4], vResults[1] + vResults[5]),
2317 mglPoint(vResults[0] + vResults[2], vResults[1] + vResults[3]),
2318 mglPoint(vResults[0] + vResults[4], vResults[1] + vResults[5]),
2319 mglPoint(vResults[0], vResults[1]),
2322 else if (sCurrentDrawingFunction.substr(0, 7) ==
"sphere(")
2326 _graph->Sphere(mglPoint(vResults[0], vResults[1]), vResults[2], sStyle.c_str());
2328 else if (sCurrentDrawingFunction.substr(0, 5) ==
"drop(")
2333 double dAspherity = 1;
2334 if (nFunctions >= 6)
2335 dShift = vResults[5];
2336 if (nFunctions >= 7)
2337 dAspherity = vResults[6];
2338 _graph->Drop(mglPoint(vResults[0], vResults[1]),
2339 mglPoint(vResults[2], vResults[3]),
2345 else if (sCurrentDrawingFunction.substr(0, 7) ==
"circle(")
2349 _graph->Circle(mglPoint(vResults[0], vResults[1]), vResults[2], sStyle.c_str());
2351 else if (sCurrentDrawingFunction.substr(0, 4) ==
"arc(")
2355 _graph->Arc(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2], vResults[3]), vResults[4], sStyle.c_str());
2357 else if (sCurrentDrawingFunction.substr(0, 5) ==
"arcv(")
2361 _graph->Arc(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2] + vResults[0], vResults[3] + vResults[1]), vResults[4], sStyle.c_str());
2363 else if (sCurrentDrawingFunction.substr(0, 6) ==
"point(")
2367 _graph->Mark(mglPoint(vResults[0], vResults[1]), sStyle.c_str());
2369 else if (sCurrentDrawingFunction.substr(0, 6) ==
"curve(")
2373 _graph->Curve(mglPoint(vResults[0], vResults[1]),
2374 mglPoint(vResults[2], vResults[3]),
2375 mglPoint(vResults[4], vResults[5]),
2376 mglPoint(vResults[6], vResults[7]), sStyle.c_str());
2378 else if (sCurrentDrawingFunction.substr(0, 8) ==
"ellipse(")
2382 _graph->Ellipse(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2], vResults[3]), vResults[4], sStyle.c_str());
2384 else if (sCurrentDrawingFunction.substr(0, 9) ==
"ellipsev(")
2388 _graph->Ellipse(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2] + vResults[0], vResults[3] + vResults[1]), vResults[4], sStyle.c_str());
2390 else if (sCurrentDrawingFunction.substr(0, 5) ==
"text(")
2392 if (!sTextString.length())
2394 sTextString = sStyle;
2397 if (nFunctions >= 4)
2398 _graph->Puts(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2], vResults[3]), sTextString.c_str(), sStyle.c_str());
2399 else if (nFunctions >= 2)
2400 _graph->Puts(mglPoint(vResults[0], vResults[1]), sTextString.c_str(), sStyle.c_str());
2404 else if (sCurrentDrawingFunction.substr(0, 8) ==
"polygon(")
2406 if (nFunctions < 5 || vResults[4] < 3)
2408 _graph->Polygon(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2], vResults[3]), (
int)vResults[4], sStyle.c_str());
2410 else if (sCurrentDrawingFunction.substr(0, 9) ==
"polygonv(")
2412 if (nFunctions < 5 || vResults[4] < 3)
2414 _graph->Polygon(mglPoint(vResults[0], vResults[1]), mglPoint(vResults[2] + vResults[0], vResults[3] + vResults[1]), (
int)vResults[4], sStyle.c_str());
2436 string sCurrentDrawingFunction;
2439 for (
unsigned int v = 0; v < vDrawVector.size(); v++)
2444 sCurrentDrawingFunction = vDrawVector[v];
2447 for (
int n = (
int)sCurrentDrawingFunction.length() - 1; n >= 0; n--)
2449 if (sCurrentDrawingFunction[n] ==
',' && !
isInQuotes(sCurrentDrawingFunction, (
unsigned)n,
true))
2451 sStyle = sCurrentDrawingFunction.substr(n + 1);
2452 sCurrentDrawingFunction.erase(n);
2457 sStyle = sStyle.substr(0, sStyle.rfind(
')')) +
" -nq";
2462 for (
int n = (
int)sCurrentDrawingFunction.length() - 1; n >= 0; n--)
2464 if (sCurrentDrawingFunction[n] ==
',' && !
isInQuotes(sCurrentDrawingFunction, (
unsigned)n,
true))
2466 sTextString = sCurrentDrawingFunction.substr(n + 1);
2467 sCurrentDrawingFunction.erase(n);
2472 sTextString +=
" -nq";
2475 if (sCurrentDrawingFunction.back() ==
')')
2476 sDrawExpr = sCurrentDrawingFunction.substr(sCurrentDrawingFunction.find(
'(') + 1, sCurrentDrawingFunction.rfind(
')') - sCurrentDrawingFunction.find(
'(') - 1);
2478 sDrawExpr = sCurrentDrawingFunction.substr(sCurrentDrawingFunction.find(
'(') + 1);
2479 if (sDrawExpr.find(
'{') != string::npos)
2483 std::vector<double> vResults =
real({vRes, vRes+nFunctions});
2484 if (sCurrentDrawingFunction.substr(0, 6) ==
"trace(" || sCurrentDrawingFunction.substr(0, 5) ==
"line(")
2489 _graph->Line(mglPoint(), mglPoint(vResults[0], vResults[1], vResults[2]), sStyle.c_str());
2491 _graph->Line(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]), sStyle.c_str());
2493 else if (sCurrentDrawingFunction.substr(0, 7) ==
"tracev(" || sCurrentDrawingFunction.substr(0, 6) ==
"linev(")
2498 _graph->Line(mglPoint(), mglPoint(vResults[0], vResults[1], vResults[2]), sStyle.c_str());
2500 _graph->Line(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3] + vResults[0], vResults[4] + vResults[1], vResults[5] + vResults[2]), sStyle.c_str());
2502 else if (sCurrentDrawingFunction.substr(0, 5) ==
"face(")
2507 _graph->Face(mglPoint(vResults[3] - vResults[4] + vResults[1], vResults[4] + vResults[3] - vResults[0], vResults[5]),
2508 mglPoint(vResults[0] + vResults[3], vResults[1] + vResults[4], vResults[2] + vResults[5]),
2509 mglPoint(vResults[0] - vResults[4] + vResults[1], vResults[1] + vResults[3] - vResults[0], vResults[2]),
2510 mglPoint(vResults[0], vResults[1], vResults[2]),
2512 else if (nFunctions < 12)
2513 _graph->Face(mglPoint(vResults[6], vResults[7], vResults[8]),
2514 mglPoint(vResults[3], vResults[4], vResults[5]),
2515 mglPoint(vResults[0] + vResults[6] - vResults[3], vResults[1] + vResults[7] - vResults[4], vResults[2] + vResults[8] - vResults[5]),
2516 mglPoint(vResults[0], vResults[1], vResults[2]),
2519 _graph->Face(mglPoint(vResults[6], vResults[7], vResults[8]),
2520 mglPoint(vResults[3], vResults[4], vResults[5]),
2521 mglPoint(vResults[9], vResults[10], vResults[11]),
2522 mglPoint(vResults[0], vResults[1], vResults[2]),
2525 else if (sCurrentDrawingFunction.substr(0, 6) ==
"facev(")
2530 _graph->Face(mglPoint(vResults[0] + vResults[3] - vResults[4], vResults[1] + vResults[4] + vResults[3], vResults[5] + vResults[2]),
2531 mglPoint(vResults[0] + vResults[3], vResults[1] + vResults[4], vResults[5] + vResults[2]),
2532 mglPoint(vResults[0] - vResults[4], vResults[1] + vResults[3], vResults[2]),
2533 mglPoint(vResults[0], vResults[1], vResults[2]),
2535 else if (nFunctions < 12)
2536 _graph->Face(mglPoint(vResults[0] + vResults[6] + vResults[3], vResults[1] + vResults[7] + vResults[4], vResults[2] + vResults[8] + vResults[5]),
2537 mglPoint(vResults[0] + vResults[6], vResults[1] + vResults[4], vResults[2] + vResults[5]),
2538 mglPoint(vResults[0] + vResults[3], vResults[1] + vResults[7], vResults[2] + vResults[8]),
2539 mglPoint(vResults[0], vResults[1], vResults[2]),
2542 _graph->Face(mglPoint(vResults[0] + vResults[6], vResults[1] + vResults[7], vResults[2] + vResults[8]),
2543 mglPoint(vResults[0] + vResults[3], vResults[1] + vResults[4], vResults[2] + vResults[5]),
2544 mglPoint(vResults[0] + vResults[9], vResults[1] + vResults[10], vResults[2] + vResults[11]),
2545 mglPoint(vResults[0], vResults[1], vResults[2]),
2548 else if (sCurrentDrawingFunction.substr(0, 9) ==
"triangle(")
2552 double c = sqrt((vResults[3] - vResults[0]) * (vResults[3] - vResults[0])
2553 + (vResults[4] - vResults[1]) * (vResults[4] - vResults[1])
2554 + (vResults[5] - vResults[2]) * (vResults[5] - vResults[2])) / 2.0 * sqrt(3) / hypot(vResults[3], vResults[4]);
2556 _graph->Face(mglPoint((-vResults[0] + vResults[3]) / 2.0 - c * vResults[4], (-vResults[1] + vResults[4]) / 2.0 + c * vResults[3], (vResults[5] + vResults[2]) / 2.0),
2557 mglPoint(vResults[3], vResults[4], vResults[5]),
2558 mglPoint((-vResults[0] + vResults[3]) / 2.0 - c * vResults[4], (-vResults[1] + vResults[4]) / 2.0 + c * vResults[3], (vResults[5] + vResults[2]) / 2.0),
2559 mglPoint(vResults[0], vResults[1], vResults[2]),
2562 _graph->Face(mglPoint(vResults[6], vResults[7], vResults[8]),
2563 mglPoint(vResults[3], vResults[4], vResults[5]),
2564 mglPoint(vResults[6], vResults[7], vResults[8]),
2565 mglPoint(vResults[0], vResults[1], vResults[2]),
2568 else if (sCurrentDrawingFunction.substr(0, 10) ==
"trianglev(")
2572 double c = sqrt((vResults[3]) * (vResults[3])
2573 + (vResults[4]) * (vResults[4])
2574 + (vResults[5]) * (vResults[5])) / 2.0 * sqrt(3) / hypot(vResults[3], vResults[4]);
2576 _graph->Face(mglPoint((vResults[0] + 0.5 * vResults[3]) - c * vResults[4], (vResults[1] + 0.5 * vResults[4]) + c * vResults[3], (vResults[5] + 0.5 * vResults[2])),
2577 mglPoint(vResults[0] + vResults[3], vResults[1] + vResults[4], vResults[2] + vResults[5]),
2578 mglPoint((vResults[0] + 0.5 * vResults[3]) - c * vResults[4], (vResults[1] + 0.5 * vResults[4]) + c * vResults[3], (vResults[5] + 0.5 * vResults[2])),
2579 mglPoint(vResults[0], vResults[1], vResults[2]),
2582 _graph->Face(mglPoint(vResults[0] + vResults[6], vResults[1] + vResults[7], vResults[2] + vResults[8]),
2583 mglPoint(vResults[0] + vResults[3], vResults[1] + vResults[4], vResults[2] + vResults[5]),
2584 mglPoint(vResults[0] + vResults[6], vResults[1] + vResults[7], vResults[2] + vResults[8]),
2585 mglPoint(vResults[0], vResults[1], vResults[2]),
2588 else if (sCurrentDrawingFunction.substr(0, 7) ==
"cuboid(")
2598 _mDx = mglPoint(vResults[3], vResults[4], vResults[5]);
2599 _mDy = mglPoint(-vResults[4], vResults[3], vResults[5]);
2600 _mDz = mglPoint(vResults[4] * vResults[5] - vResults[3] * vResults[5],
2601 -vResults[4] * vResults[5] - vResults[3] * vResults[5],
2602 vResults[3] * vResults[3] + vResults[4] * vResults[4])
2603 / sqrt(vResults[3] * vResults[3] + vResults[4] * vResults[4] + vResults[5] * vResults[5]);
2605 else if (nFunctions < 12)
2607 _mDx = mglPoint(vResults[3], vResults[4], vResults[5]);
2608 _mDy = mglPoint(vResults[6], vResults[7], vResults[8]);
2609 _mDz = mglPoint(vResults[4] * vResults[8] - vResults[7] * vResults[5],
2610 vResults[6] * vResults[5] - vResults[3] * vResults[8],
2611 vResults[3] * vResults[7] - vResults[6] * vResults[4]) * 2.0
2612 / (sqrt(vResults[3] * vResults[3] + vResults[4] * vResults[4] + vResults[5] * vResults[5])
2613 + sqrt(vResults[6] * vResults[6] + vResults[7] * vResults[7] + vResults[8] * vResults[8]));
2617 _mDx = mglPoint(vResults[3], vResults[4], vResults[5]);
2618 _mDy = mglPoint(vResults[6], vResults[7], vResults[8]);
2619 _mDz = mglPoint(vResults[9], vResults[10], vResults[11]);
2622 _graph->Face(mglPoint(vResults[0], vResults[1], vResults[2]),
2623 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDx,
2624 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDy,
2625 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDx + _mDy,
2627 _graph->Face(mglPoint(vResults[0], vResults[1], vResults[2]),
2628 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDx,
2629 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDz,
2630 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDz + _mDx,
2632 _graph->Face(mglPoint(vResults[0], vResults[1], vResults[2]),
2633 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDy,
2634 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDz,
2635 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDy + _mDz,
2637 _graph->Face(mglPoint(vResults[0], vResults[1], vResults[2]) + _mDz,
2638 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDx + _mDz,
2639 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDy + _mDz,
2640 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDx + _mDy + _mDz,
2642 _graph->Face(mglPoint(vResults[0], vResults[1], vResults[2]) + _mDy,
2643 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDx + _mDy,
2644 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDz + _mDy,
2645 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDz + _mDx + _mDy,
2647 _graph->Face(mglPoint(vResults[0], vResults[1], vResults[2]) + _mDx,
2648 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDy + _mDx,
2649 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDz + _mDx,
2650 mglPoint(vResults[0], vResults[1], vResults[2]) + _mDy + _mDz + _mDx,
2653 else if (sCurrentDrawingFunction.substr(0, 7) ==
"sphere(")
2657 _graph->Sphere(mglPoint(vResults[0], vResults[1], vResults[2]), vResults[3], sStyle.c_str());
2659 else if (sCurrentDrawingFunction.substr(0, 5) ==
"cone(")
2663 if (nFunctions >= 8)
2664 _graph->Cone(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]), vResults[6], vResults[7], sStyle.c_str());
2666 _graph->Cone(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]), vResults[6], 0.0, sStyle.c_str());
2668 else if (sCurrentDrawingFunction.substr(0, 6) ==
"conev(")
2672 if (nFunctions >= 8)
2673 _graph->Cone(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]) + mglPoint(vResults[0], vResults[1], vResults[2]), vResults[6], vResults[7], sStyle.c_str());
2675 _graph->Cone(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]) + mglPoint(vResults[0], vResults[1], vResults[2]), vResults[6], 0.0, sStyle.c_str());
2677 else if (sCurrentDrawingFunction.substr(0, 5) ==
"drop(")
2682 double dAspherity = 1;
2683 if (nFunctions >= 8)
2684 dShift = vResults[7];
2685 if (nFunctions >= 9)
2686 dAspherity = vResults[8];
2687 _graph->Drop(mglPoint(vResults[0], vResults[1], vResults[2]),
2688 mglPoint(vResults[3], vResults[4], vResults[5]),
2694 else if (sCurrentDrawingFunction.substr(0, 7) ==
"circle(")
2698 _graph->Circle(mglPoint(vResults[0], vResults[1], vResults[2]), vResults[3], sStyle.c_str());
2700 else if (sCurrentDrawingFunction.substr(0, 4) ==
"arc(")
2705 _graph->Arc(mglPoint(vResults[0], vResults[1], vResults[2]),
2706 mglPoint(vResults[3], vResults[4], vResults[5]), vResults[6], sStyle.c_str());
2708 _graph->Arc(mglPoint(vResults[0], vResults[1], vResults[2]),
2709 mglPoint(vResults[3], vResults[4], vResults[5]),
2710 mglPoint(vResults[6], vResults[7], vResults[8]),
2711 vResults[9], sStyle.c_str());
2714 else if (sCurrentDrawingFunction.substr(0, 5) ==
"arcv(")
2719 _graph->Arc(mglPoint(vResults[0], vResults[1], vResults[2]),
2720 mglPoint(vResults[3], vResults[4], vResults[5]) + mglPoint(vResults[0], vResults[1], vResults[2]), vResults[6], sStyle.c_str());
2722 _graph->Arc(mglPoint(vResults[0], vResults[1], vResults[2]),
2723 mglPoint(vResults[3], vResults[4], vResults[5]) + mglPoint(vResults[0], vResults[1], vResults[2]),
2724 mglPoint(vResults[6], vResults[7], vResults[8]) + mglPoint(vResults[0], vResults[1], vResults[2]),
2725 vResults[9], sStyle.c_str());
2728 else if (sCurrentDrawingFunction.substr(0, 6) ==
"point(")
2732 _graph->Mark(mglPoint(vResults[0], vResults[1], vResults[2]), sStyle.c_str());
2734 else if (sCurrentDrawingFunction.substr(0, 6) ==
"curve(")
2736 if (nFunctions < 12)
2738 _graph->Curve(mglPoint(vResults[0], vResults[1], vResults[2]),
2739 mglPoint(vResults[3], vResults[4], vResults[5]),
2740 mglPoint(vResults[6], vResults[7], vResults[8]),
2741 mglPoint(vResults[9], vResults[10], vResults[11]), sStyle.c_str());
2743 else if (sCurrentDrawingFunction.substr(0, 8) ==
"ellipse(")
2747 _graph->Ellipse(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]), vResults[6], sStyle.c_str());
2749 else if (sCurrentDrawingFunction.substr(0, 9) ==
"ellipsev(")
2753 _graph->Ellipse(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]) + mglPoint(vResults[0], vResults[1], vResults[2]), vResults[6], sStyle.c_str());
2755 else if (sCurrentDrawingFunction.substr(0, 5) ==
"text(")
2757 if (!sTextString.length())
2759 sTextString = sStyle;
2762 if (nFunctions >= 6)
2763 _graph->Puts(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]), sTextString.c_str(), sStyle.c_str());
2764 else if (nFunctions >= 3)
2765 _graph->Puts(mglPoint(vResults[0], vResults[1], vResults[2]), sTextString.c_str(), sStyle.c_str());
2769 else if (sCurrentDrawingFunction.substr(0, 8) ==
"polygon(")
2771 if (nFunctions < 7 || vResults[6] < 3)
2773 _graph->Polygon(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]), (
int)vResults[6], sStyle.c_str());
2775 else if (sCurrentDrawingFunction.substr(0, 9) ==
"polygonv(")
2777 if (nFunctions < 7 || vResults[6] < 3)
2779 _graph->Polygon(mglPoint(vResults[0], vResults[1], vResults[2]), mglPoint(vResults[3], vResults[4], vResults[5]) + mglPoint(vResults[0], vResults[1], vResults[2]), (
int)vResults[6], sStyle.c_str());
2800 string sConvLegends =
"";
2801 bool useImag =
false;
2815 int nDataOffset = 0;
2844 _mData2[j] = 0.0 * _mData[j];
2852 for (
int i = 0; i <
getNN(_mData[j]); i++)
2855 _mData[j].a[i] = NAN;
2878 for (
int k = 0; k < 2; k++)
2882 sConvLegends =
"\"" + sConvLegends +
"\"";
2884 for (
unsigned int l = 0; l < sConvLegends.length(); l++)
2886 if (sConvLegends[l] ==
'(')
2889 if (sConvLegends[l] ==
',')
2891 sConvLegends =
"\"[" + sConvLegends.substr(1, sConvLegends.length() - 2) +
"]\"";
2896 if (sConvLegends !=
"\"\"")
2911 sConvLegends = useImag ?
"Im(" + sConvLegends +
")" :
"Re(" + sConvLegends +
")";
2913 sConvLegends =
"\"" + sConvLegends +
"\"";
2915 if (sConvLegends !=
"\"\"")
2930 sConvLegends = useImag ?
"Im(" + sConvLegends +
")" :
"Re(" + sConvLegends +
")";
2932 sConvLegends =
"\"" + sConvLegends +
"\"";
2934 if (sConvLegends !=
"\"\"")
2937 std::string sLegendStyle;
2956 _graph->AddLegend(sLegend.c_str(), sLegendStyle.c_str());
2989 _graph->SetCutBox(mglPoint(0), mglPoint(0));
2991 if (nPlotCompose + 1 == nPlotComposeSize
2997 _graph->Legend(1.35, 1.2);
3016#warning NOTE (numere#3#08/15/21): Temporary fix for MathGL misbehaviour
3039 &&
getNN(_mData2[0]))
3108 for (
int m = 0; m < _mData[0].nx; m++)
3132 return _mData.nx * _mData.ny * _mData.nz;
3151 string sExt =
".png";
3156 if (nPlotComposeSize > 1)
3201 string sTemp_2 =
"";
3202 string sExtension = sTemp.substr(sTemp.find(
'.'));
3203 sTemp = sTemp.substr(0, sTemp.find(
'.'));
3205 if (sExtension[sExtension.length() - 1] ==
'"')
3208 sExtension = sExtension.substr(0, sExtension.length() - 1);
3291 return sCurrentStyle;
3293 string sExpandedStyle;
3296 for (
size_t i = 1; i <= 9; i++)
3298 sExpandedStyle +=
"{" + sCurrentStyle.substr(0, 1) +
toString(i) +
"}" + sCurrentStyle.substr(1);
3301 return sExpandedStyle;
3326 string sSubPlotIDX = sCmd.substr(
findCommand(sCmd).nPos + 7);
3327 if (sSubPlotIDX.find(
"-set") != string::npos || sSubPlotIDX.find(
"--") != string::npos)
3329 if (sSubPlotIDX.find(
"-set") != string::npos)
3330 sSubPlotIDX.erase(sSubPlotIDX.find(
"-set"));
3332 sSubPlotIDX.erase(sSubPlotIDX.find(
"--"));
3337 unsigned int nMultiLines = 1, nMultiCols = 1;
3349 if (sSubPlotIDX.length())
3364 if ((
unsigned int)
intCast(v[0]) - 1 >= nMultiplots[0]*nMultiplots[1])
3368 _graph->MultiPlot(nMultiplots[0], nMultiplots[1], (
unsigned int)
intCast(v[0]) - 1, nMultiCols, nMultiLines);
3372 if ((
unsigned int)(
intCast(v[1]) - 1 + (
intCast(v[0]) - 1)*nMultiplots[1]) >= nMultiplots[0]*nMultiplots[1])
3376 _graph->MultiPlot(nMultiplots[0], nMultiplots[1], (
unsigned int)((
intCast(v[1]) - 1) + (
intCast(v[0]) - 1)*nMultiplots[0]), nMultiCols, nMultiLines);
3381 if (nSubPlots >= nMultiplots[0]*nMultiplots[1])
3384 for (
unsigned int nSub = 0; nSub < nMultiplots[0]*nMultiplots[1]; nSub++)
3386 if (nPlotPos & nSubPlotMap)
3392 _graph->MultiPlot(nMultiplots[0], nMultiplots[1], nSub, nMultiCols, nMultiLines);
3395 if (nSub == nMultiplots[0]*nMultiplots[1] - 1)
3404 if (sSubPlotIDX.length())
3419 if ((
unsigned int)
intCast(v[0]) - 1 >= nMultiplots[0]*nMultiplots[1])
3421 if ((
unsigned int)
intCast(v[0]) != 1)
3422 nRes <<= (
unsigned int)(
intCast(v[0]) - 1);
3423 if (nRes & nSubPlotMap)
3425 nSubPlotMap |= nRes;
3426 _graph->SubPlot(nMultiplots[0], nMultiplots[1], (
unsigned int)
intCast(v[0]) - 1);
3430 if ((
unsigned int)(
intCast(v[1]) - 1 + (
intCast(v[0]) - 1)*nMultiplots[0]) >= nMultiplots[0]*nMultiplots[1])
3433 if ((
unsigned int)(
intCast(v[1]) + (
intCast(v[0]) - 1)*nMultiplots[0]) != 1)
3434 nRes <<= (
unsigned int)((
intCast(v[1]) - 1) + (
intCast(v[0]) - 1) * nMultiplots[0]);
3435 if (nRes & nSubPlotMap)
3437 nSubPlotMap |= nRes;
3438 _graph->SubPlot(nMultiplots[0], nMultiplots[1], (
unsigned int)((
intCast(v[1]) - 1) + (
intCast(v[0]) - 1)*nMultiplots[0]));
3443 if (nSubPlots >= nMultiplots[0]*nMultiplots[1])
3446 for (
unsigned int nSub = 0; nSub < nMultiplots[0]*nMultiplots[1]; nSub++)
3448 if (nPlotPos & nSubPlotMap)
3452 nSubPlotMap |= nPlotPos;
3453 _graph->SubPlot(nMultiplots[0], nMultiplots[1], nSub);
3456 if (nSub == nMultiplots[0]*nMultiplots[1] - 1)
3592 string sFuncTemp =
sFunc;
3595 while (sFuncTemp.length())
3603 && !
_data.
isTable(sToken.substr(0, sToken.find_first_of(
"({")))
3604 && !
_data.
isCluster(sToken.substr(0, sToken.find_first_of(
"({"))))
3607 string sSubstr = sToken.substr(
getMatchingParenthesis(sToken.substr(sToken.find_first_of(
"({"))) + sToken.find_first_of(
"({") + 1);
3609 if (sSubstr[sSubstr.find_first_not_of(
' ')] !=
'"' && sSubstr[sSubstr.find_first_not_of(
' ')] !=
'#')
3618 std::vector<std::string> vDataPlots;
3620 while (sFuncTemp.length())
3623 size_t nPos = sToken.find_first_of(
"#\"");
3632 vDataPlots.push_back(sToken.substr(0, nPos));
3641 sFunc +=
"," + sToken.substr(0, nPos);
3665 size_t typeCounter = 0;
3683 for (
size_t i = 0; i < vDataPlots.size(); i++)
3685 size_t nParPos = vDataPlots[i].find_first_of(
"({");
3735 size_t datarows = 1;
3757 for (
size_t n = 0; n < _idx.
row.
size(); n++)
3766 for (
size_t n = 0; n < vAxis.size(); n++)
3780 for (
size_t n = 0; n < vVals.size(); n++)
3787 for (
size_t q = 0; q < datarows; q++)
3792 for (
size_t n = 0; n < _idx.
row.
size(); n++)
3797 for (
size_t n = 0; n < _idx.
row.
size(); n++)
3806 for (
size_t n = 0; n < vVals.size(); n++)
3826 for (
size_t layer = 1; layer <
std::max(1u, isMultiDataSet*
m_manager.
assets[typeCounter].getLayers()); layer++)
3831 if (!(typeCounter % 2) &&
m_manager.
assets[typeCounter].boundAxes.find(
't') != std::string::npos)
3840 if (
m_manager.
assets[typeCounter].boundAxes.find(
't') != std::string::npos)
3845 for (
size_t layer = 0; layer <
std::max(1u, isMultiDataSet*
m_manager.
assets[typeCounter].getLayers()); layer++)
3849 if (
m_manager.
assets[typeCounter].boundAxes.find(
'r') != std::string::npos)
3858 size_t datarows = 1;
3871 for (
size_t q = 0; q < 3*datarows; q++)
3878 for (
size_t t = 0; t < _idx.
row.
size(); t++)
3887 for (
size_t t = 0; t < vVals.size(); t++)
3924 for (
size_t axis = 0; axis < samples.size(); axis++)
3927 _idx.
row, _idx.
col[axis],
3930 for (
size_t m = 0; m <
std::min(samples[axis]-isBars, vAxis.size()); m++)
3952 #pragma omp parallel for
3953 for (
size_t y = 0; y < samples[1]-isBars; y++)
3959 for (
size_t x = 0; x <
std::min(samples[0]-isBars, vVals.size()); x++)
3991 for (
size_t axis = 0; axis < samples.size(); axis++)
3994 _idx.
row, _idx.
col[axis],
3997 for (
size_t m = 0; m <
std::min(samples[axis], vAxis.size()); m++)
4004 #pragma omp parallel for
4005 for (
size_t y = 0; y < samples[1]; y++)
4011 for (
size_t x = 0; x <
std::min(samples[0], vVals.size()); x++)
4056 && (sTemp.find(
',') != string::npos || sTemp.substr(sTemp.find(
'('), 2) ==
"()")
4057 && sTemp.find(
')') != string::npos)
4065 string sTableName = sTemp.substr(0, sTemp.find(
'('));
4081 sArgs = sArgs.substr(1, sArgs.length()-2);
4083 string sArg_1 = sArgs;
4084 string sArg_2 =
"<<empty>>";
4085 string sArg_3 =
"<<empty>>";
4098 else if (sArg_1.find(
':') != string::npos)
4101 sArg_1 = indices[0];
4103 if (indices.size() > 1)
4105 sArg_2 = indices[1];
4107 if (indices.size() > 2)
4108 sArg_3 = indices[2];
4120 if (!sArg_1.length() && !sArg_2.length() && sArg_3 ==
"<<empty>>")
4124 else if (!sArg_1.length())
4129 if (sArg_2 ==
"<<empty>>" && sArg_3 ==
"<<empty>>" &&
_pInfo.
sCommand !=
"plot3d")
4134 else if (sArg_2.length())
4145 double dArg_1, dArg_2;
4165 else if (sArg_3 !=
"<<empty>>")
4170 double dArg_1, dArg_2;
4176 if (dArg_1 < dArg_2)
4184 else if (sArg_3 ==
"<<empty>>" || !sArg_3.length())
4187 double dArg_1, dArg_2;
4193 if (dArg_1 < dArg_2)
4202 else if (sArg_3.length())
4210 else if (!sArg_2.length())
4240 else if (sArg_3 ==
"<<empty>>" || !sArg_3.length())
4247 else if (sArg_3.length())
4260 for (
size_t i = 0; i < sTemp.size(); i++)
4262 if (sTemp[i] ==
'{' || sTemp[i] ==
'}')
4264 sTemp.insert(i, 1,
'\\');
4301 string sFirst =
"[";
4315 string sLegend = sFirst;
4318 for (
int i = nStart; i < nResults; i++)
4321 if (i + 1 < nResults)
4324 return sLegend + sLast;
4338 size_t nElements = 0;
4341 for (
int i = 0; i < _mData.nx; i++)
4344 if (!
isnan(_mData.a[i]))
4365 for (
size_t i = 0; i <
m_types.size(); i++)
4373 for (
size_t i = 0; i <
m_types.size(); i++)
4381 for (
size_t i = 0; i <
m_types.size(); i++)
4389 for (
size_t i = 0; i <
m_types.size(); i++)
4397 for (
size_t i = 0; i <
m_types.size(); i++)
4405 for (
size_t i = 0; i <
m_types.size(); i++)
4430 if (!nPlotCompose || bNewSubPlot)
4536 int nThetaCoord =
YCOORD;
4593 if (!
sFunc.length())
4596 std::vector<size_t> vFuncMap;
4598 for (
size_t i = 0; i <
m_types.size(); i++)
4601 vFuncMap.push_back(i);
4635 for (
size_t k = 0; k < vFuncMap.size(); k++)
4658 for (
int t = 0; t < nRenderSamples; t++)
4664 double dSamples = 1.0;
4675 nRenderSamples = (int)dSamples + 1;
4734 for (
size_t i = 0; i < vFuncMap.size(); i++)
4777 for (
size_t i = 0; i < vFuncMap.size(); i++)
4792 for (
size_t k = 0; k < vFuncMap.size(); k++)
4808 for (
int i = 0; i < 2; i++)
4826 for (
size_t k = 0; k < vFuncMap.size(); k++)
4846 for (
int i = 0; i < 3; i++)
4890 if (
isnan(functionIntervals[0].front())
4891 ||
isnan(functionIntervals[0].back())
4892 ||
isinf(functionIntervals[0].front())
4893 ||
isinf(functionIntervals[0].back()))
4916 && (!nPlotCompose || bNewSubPlot))
4958 ? 0.0 : -INFINITY));
4999 ? 0.0 : -INFINITY));
5020 _pInfo.
ranges[i] = dataCoordIntervals[ivlID].combine(coordIntervals[ivlID]);
5130 double dMin = ivl.
min() / dScale;
5131 double dMax = ivl.
max() / dScale;
5135 double factor = 2.0;
5139 if (ivl.
range() < 0.2 * dScale)
5141 else if (ivl.
range() < 0.5 * dScale)
5143 else if (ivl.
range() < 0.8 * dScale)
5152 dMin =
std::floor(dMin * factor) / factor * dScale;
5153 dMax =
std::ceil(dMax * factor) / factor * dScale;
5157 if (isLogarithmic && dMin <= 0.0)
5160 ivl.
reset(dMin, dMax);
5203 double newRange = range / aspect -
_pInfo.
ranges[i].range();
5286 double dMin = zfuncIntervals[0].min();
5287 double dMax = zfuncIntervals[0].max();
5302 dColorMin = dColorMax * 1e-3;
5303 _graph->SetRange(
'c', dColorMin, dColorMax + 0.05 * (dColorMax - dColorMin));
5313 _graph->SetRange(
'c', 0, 255.0);
5333 _graph->SetRange(
'c', 1e-3, 1.05);
5335 _graph->SetRange(
'c', -1.05, 1.05);
5340 _graph->SetRange(
'c', 1e-3, 1.05);
5342 _graph->SetRange(
'c', -0.05, 1.05);
5348 double dMin = funcIntervals[0].min();
5349 double dMax = funcIntervals[0].max();
5459 double dMin = zfuncIntervals[0].min();
5460 double dMax = zfuncIntervals[0].max();
5474 dColorMin = dColorMax * 1e-3;
5492 double dMin = funcIntervals[0].min();
5493 double dMax = funcIntervals[0].max();
5530 _graph->SetTicksVal(
'c',
"--\\pi\n--\\pi/2\n0\n\\pi/2\n\\pi");
5569 _graph->SetTicksVal(
'c',
"--\\pi\n--\\pi/2\n0\n\\pi/2\n\\pi");
5630 _graph->AddLight(0, mglPoint(0, 0, 1),
'w', 0.35);
5631 _graph->AddLight(1, mglPoint(5, 30, 5),
'w', 0.15);
5632 _graph->AddLight(2, mglPoint(5, -30, 5),
'w', 0.06);
5636 _graph->AddLight(0, mglPoint(0, 0, 1),
'w', 0.25);
5637 _graph->AddLight(1, mglPoint(5, 30, 5),
'w', 0.1);
5638 _graph->AddLight(2, mglPoint(5, -30, 5),
'w', 0.04);
5645 _graph->AddLight(1, mglPoint(-5, 5, 1),
'w', 0.4);
5646 _graph->AddLight(2, mglPoint(-3, 3, 9),
'w', 0.1);
5647 _graph->AddLight(3, mglPoint(5, -5, 1),
'w', 0.1);
5651 _graph->AddLight(1, mglPoint(-5, 5, 1),
'w', 0.2);
5652 _graph->AddLight(2, mglPoint(-3, 3, 9),
'w', 0.05);
5653 _graph->AddLight(3, mglPoint(5, -5, 1),
'w', 0.05);
5678 _graph->SetRanges(0.1, 10.0, 0.1, 10.0, 0.1, 10.0);
5703 mglPoint _mPoint(0.0, 0.0, 0.0);
5707 _mPoint.x = dNorm * cos(dPhi / 180.0 *
M_PI + M_PI_4) * sin(dTheta / 180.0 *
M_PI);
5708 _mPoint.y = dNorm * sin(dPhi / 180.0 *
M_PI + M_PI_4) * sin(dTheta / 180.0 *
M_PI);
5711 _mPoint += _mDirection;
5725 _mDirection = _mDirection - _mPoint;
5727 _graph->AddLight(nId, _mPoint, _mDirection, cColor, dBrightness);
5782 if (dPhi >= 0.0 && dPhi < 90.0)
5807 else if (dPhi >= 90.0 && dPhi < 180.0)
5832 else if (dPhi >= 180.0 && dPhi < 270.0)
5903 return mglPoint(r, phi, theta);
5908 return mglPoint(phi, theta, r);
5910 return mglPoint(r, phi, theta);
5912 return mglPoint(r, theta, phi);
5914 return mglPoint(phi, theta, r);
5916 return mglPoint(r, phi, theta);
5918 return mglPoint(r, theta, phi);
5920 return mglPoint(r, phi, theta);
5941 if (dPhi >= 0.0 && dPhi < 90.0)
5948 else if (dPhi >= 90.0 && dPhi < 180.0)
5955 else if (dPhi >= 180.0 && dPhi < 270.0)
5988 return sLegend.substr(0, 1) +
"-";
5990 return "k" + sLegend.substr(1);
6014 mglData _mReturn(_mData.nx, _mData.ny, _mData.nz);
6016 for (
long int i = 0; i <
getNN(_mData); i++)
6018 _mReturn.a[i] =
::fmod(_mData.a[i], dDenominator);
6020 if (_mReturn.a[i] < 0)
6021 _mReturn.a[i] += dDenominator;
6071 _graph->SetTickTempl(
'x' + i,
"%g");
6073 _graph->SetTickTempl(
'c',
"%g");
6079 mglData _mAxisRange;
6089 _mAxisRange.Create(nCount);
6130 for (
int n = 0; n < nCount; n++)
6146 _mAxisRange.Create(nCount);
6152 for (
int n = 0; n < nCount; n++)
6186 if (_axis.
sLabel.length())
6197 if (_axis.
sLabel.length())
6241 _graph->SetFunc(
"x*cos(y)",
"x*sin(y)");
6247 _graph->SetFunc(
"y*cos(x)",
"y*sin(x)");
6267 _graph->SetOrigin(0.0, 0.0);
6291 _graph->SetTickLen(1e-20);
6307 _graph->SetFunc(
"x*cos(y)",
"x*sin(y)",
"z");
6345 _graph->SetTickLen(1e-20);
6361 _graph->SetFunc(
"x*cos(y)*sin(z)",
"x*sin(y)*sin(z)",
"x*cos(z)");
6404 _graph->SetTickLen(1e-20);
6413 _graph->SetFunc(
"x*cos(y)",
"x*sin(y)");
6451 _graph->SetFunc(
"z*cos(x)",
"z*sin(x)",
"y");
6476 _graph->SetFunc(
"x*cos(y)",
"x*sin(y)",
"z");
6501 _graph->SetFunc(
"x*cos(z)",
"x*sin(z)",
"y");
6526 _graph->SetFunc(
"z*cos(x)*sin(y)",
"z*sin(x)*sin(y)",
"z*cos(y)");
6552 _graph->SetFunc(
"x*cos(y)*sin(z)",
"x*sin(y)*sin(z)",
"x*cos(z)");
6578 _graph->SetFunc(
"x*cos(z)*sin(y)",
"x*sin(z)*sin(y)",
"x*cos(y)");
6625 _graph->SetOrigin(0.0, 0.0, 0.0);
6628 _graph->Axis(
"AKDTVISO");
6631 _graph->SetTickLen(1e-20);
6632 _graph->SetTicks(
'x', -5, 1);
6633 _graph->SetTicks(
'y', -5, 1);
6634 _graph->SetTicks(
'z', -5, 1);
6635 _graph->Axis(
"AKDTVISO_");
6648 _graph->Axis(
"AKDTVISO");
6651 _graph->SetTickLen(1e-20);
6652 _graph->SetTicks(
'x', -5, 1);
6653 _graph->SetTicks(
'y', -5, 1);
6654 _graph->Axis(
"AKDTVISO_");
6665 _graph->Axis(
"AKDTVISO");
6668 _graph->SetTickLen(1e-20);
6669 _graph->SetTicks(
'x', -5, 1);
6670 _graph->SetTicks(
'y', -5, 1);
6671 _graph->SetTicks(
'z', -5, 1);
6672 _graph->Axis(
"AKDTVISO_");
6686 _graph->Axis(
"AKDTVISO");
6689 _graph->SetTickLen(1e-20);
6690 _graph->SetTicks(
'x', -5, 1);
6691 _graph->SetTicks(
'y', -5, 1);
6692 _graph->Axis(
"AKDTVISO_");
6710 _graph->Axis(
"AKDTVISO");
6713 _graph->SetTickLen(1e-20);
6714 _graph->SetTicks(
'x', -5, 1);
6715 _graph->SetTicks(
'y', -5, 1);
6716 _graph->SetTicks(
'z', -5, 1);
6717 _graph->Axis(
"AKDTVISO_");
6728 _graph->Axis(
"AKDTVISO");
6731 _graph->SetTickLen(1e-20);
6732 _graph->SetTicks(
'x', -5, 1);
6733 _graph->SetTicks(
'y', -5, 1);
6734 _graph->Axis(
"AKDTVISO_");
6749 _graph->Axis(
"AKDTVISO");
6752 _graph->SetTickLen(1e-20);
6753 _graph->SetTicks(
'x', -5, 1);
6754 _graph->SetTicks(
'y', -5, 1);
6755 _graph->SetTicks(
'z', -5, 1);
6756 _graph->Axis(
"AKDTVISO_");
6769 _graph->Axis(
"AKDTVISO");
6772 _graph->SetTickLen(1e-20);
6773 _graph->SetTicks(
'x', -5, 1);
6774 _graph->SetTicks(
'y', -5, 1);
6775 _graph->Axis(
"AKDTVISO_");
6784 _graph->SetOrigin(0.0, 0.0, 0.0);
6787 _graph->Axis(
"AKDTVISO");
6790 _graph->SetTickLen(1e-20);
6791 _graph->SetTicks(
'x', -5, 1);
6792 _graph->SetTicks(
'y', -5, 1);
6793 _graph->SetTicks(
'z', -5, 1);
6794 _graph->Axis(
"AKDTVISO_");
6806 _graph->Axis(
"AKDTVISO");
6809 _graph->SetTickLen(1e-20);
6810 _graph->SetTicks(
'x', -5, 1);
6811 _graph->SetTicks(
'y', -5, 1);
6812 _graph->Axis(
"AKDTVISO_");
6822 _graph->Axis(
"AKDTVISO");
6825 _graph->SetTickLen(1e-20);
6826 _graph->SetTicks(
'x', -5, 1);
6827 _graph->SetTicks(
'y', -5, 1);
6828 _graph->SetTicks(
'z', -5, 1);
6829 _graph->Axis(
"AKDTVISO_");
6839 _graph->Axis(
"AKDTVISO");
6842 _graph->SetTickLen(1e-20);
6843 _graph->SetTicks(
'x', -5, 1);
6844 _graph->SetTicks(
'y', -5, 1);
6845 _graph->SetTicks(
'z', -5, 1);
6846 _graph->Axis(
"AKDTVISO_");
6910 const int RCOORD =
XCOORD;
6911 const int PHICOORD =
YCOORD;
6912 const int THETACOORD =
ZCOORD;
6913 int nCoordMap[] = {RCOORD, PHICOORD,
ZCOORD};
6919 dCoordPos[RCOORD] = -0.4;
6920 dCoordPos[THETACOORD] = -0.9;
6926 nCoordMap[
XCOORD] = PHICOORD;
6928 nCoordMap[
ZCOORD] = RCOORD;
6931 nCoordMap[
XCOORD] = RCOORD;
6932 nCoordMap[
YCOORD] = PHICOORD;
6936 nCoordMap[
XCOORD] = RCOORD;
6938 nCoordMap[
ZCOORD] = PHICOORD;
6941 nCoordMap[
XCOORD] = PHICOORD;
6942 nCoordMap[
YCOORD] = THETACOORD;
6943 nCoordMap[
ZCOORD] = RCOORD;
6946 nCoordMap[
XCOORD] = RCOORD;
6947 nCoordMap[
YCOORD] = PHICOORD;
6948 nCoordMap[
ZCOORD] = THETACOORD;
6951 nCoordMap[
XCOORD] = RCOORD;
6952 nCoordMap[
YCOORD] = THETACOORD;
6953 nCoordMap[
ZCOORD] = PHICOORD;
6959 return dCoordPos[nCoordMap[nCoord]];
6977 _graph->SetTickLen(1e-20);
7010 string sParsedFunction = sFuncDef;
7012 if (dPhiScale == 1.0)
7014 while (sParsedFunction.find(
"$PS$") != string::npos)
7015 sParsedFunction.replace(sParsedFunction.find(
"$PS$"), 4,
"1");
7019 while (sParsedFunction.find(
"$PS$") != string::npos)
7020 sParsedFunction.replace(sParsedFunction.find(
"$PS$"), 4,
"(" +
toString(dPhiScale, 5) +
")");
7023 if (dThetaScale == 1.0)
7025 while (sParsedFunction.find(
"$TS$") != string::npos)
7026 sParsedFunction.replace(sParsedFunction.find(
"$TS$"), 4,
"1");
7030 while (sParsedFunction.find(
"$TS$") != string::npos)
7031 sParsedFunction.replace(sParsedFunction.find(
"$TS$"), 4,
"(" +
toString(dThetaScale, 5) +
")");
7034 return sParsedFunction;
7051 for (
int i = 0; i < nNum; i++)
7075bool Plot::checkMultiPlotArray(
unsigned int nMultiPlot[2],
unsigned int& nSubPlotMap,
unsigned int nPlotPos,
unsigned int nCols,
unsigned int nLines)
7078 if (nPlotPos + nCols - 1 >= (nPlotPos / nMultiPlot[0] + 1)*nMultiPlot[0])
7081 if (nPlotPos / nMultiPlot[0] + nLines - 1 >= nMultiPlot[1])
7084 unsigned int nCol0, nLine0, pos;
7085 nCol0 = nPlotPos % nMultiPlot[0];
7086 nLine0 = nPlotPos / nMultiPlot[0];
7088 for (
unsigned int i = 0; i < nLines; i++)
7090 for (
unsigned int j = 0; j < nCols; j++)
7093 pos <<= ((nCol0 + j) + nMultiPlot[0] * (nLine0 + i));
7095 if (pos & nSubPlotMap)
7100 for (
unsigned int i = 0; i < nLines; i++)
7102 for (
unsigned int j = 0; j < nCols; j++)
7105 pos <<= ((nCol0 + j) + nMultiPlot[0] * (nLine0 + i));
This class is defined to abstrahize the determination of the correct data object and the calculation ...
Indices & getIndices()
Returns a reference to the stored indices.
void evalIndices()
Evaluates open end indices using the identified data object size.
bool isCluster() const
Determines, whether the data access references a cluster.
std::string & getDataObject()
Returns a reference to the data object identifier.
std::vector< size_t > getDataGridDimensions() const
Covenience wrapper method for the global function.
This class extends the std::vector for endlessness.
This class implements the function definition managing instance.
bool call(std::string &sExpr, int nRecursion=0)
This function searches for known custom definitions in the passed expression and replaces them with t...
This class encapsulates the mglGraph object during transmission from the kernel to the GUI.
This class represents a single interval in code providing reading access functionality.
Interval combine(const Interval &_ivl) const
Returns the (continous) interval, which contains this and the passed interval.
double range() const
Return the real inteval range of this interval.
void reset(const std::string &sDef)
Reset the interval with a new definition.
mu::value_type front() const
Return the first element in the interval.
double max() const
Return the maximal element in the interval.
double min() const
Return the minimal element in the interval.
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
This class represents the central memory managing instance. It will handle all tables and clusters,...
std::string getTopHeadLineElement(int _i, const std::string &_sTable) const
int getLines(StringView sTable, bool _bFull=false) const
bool isTable(const std::string &sTable) const
This member function returns, whether the passed table name corresponds to a known table.
bool containsTables(const std::string &sExpression)
This member function detects, whether a table is used in the current expression.
bool isValid() const
Evaluates, whether there's at least a single non-empty table.
bool updateDimensionVariables(StringView sTableName)
This member function updates the dimension variables for the selected table to be used in expressions...
bool containsTablesOrClusters(const std::string &sCmdLine)
This member function evaluates, whether the passed command line contains tables or clusters.
int getCols(StringView sTable, bool _bFull=false) const
int getColElements(const VectorIndex &cols, const std::string &_sTable) const
Returns the maximal number of elements in the selected column range.
size_t size() const
This member function returns the size of the internal memory buffer as items.
Cluster & getCluster(StringView sCluster)
This member function returns a reference to the cluster indicated by the passed cluster identifier.
bool isCluster(StringView sCluster) const
This member function returns true, if the passed cluster identifier can be found in the internal map.
StringParserRetVal evalAndFormat(std::string &sLine, std::string &sCache, bool bSilent=false, bool bCheckAssertions=false)
This public member function evaluates the passed string expression and formats the results for the co...
void getStringValues(std::string &sLine)
This public member function resolves all string variable occurences and replaces them with their valu...
bool setItemGraph(GraphHelper *_helper, int windowItemID)
Updates the graph in the custom window.
WindowInformation getWindowInformation(size_t windowId)
This public member function will return the window information stored in the internal map....
size_t createWindow(GraphHelper *graph)
This public member function will create a window object containing the passed graph.
static NumeReKernel * getInstance()
This static member function returns a a pointer to the singleton instance of the kernel.
NumeRe::StringParser & getStringParser()
NumeRe::WindowManager & getWindowManager()
static void printPreFmt(const std::string &__sLine, bool printingEnabled=true)
This member function appends the pre- formatted string to the buffer and informs the terminal that we...
void weightedRange(int coord, Interval &ivl) const
This member function does the "undefined data point" magic, where the range of the plot is chosen so ...
IntervalSet getDataIntervals(int coord=ALLRANGES) const
Returns the intervals fitting to all selected data.
IntervalSet getFunctionIntervals(int coord=ALLRANGES) const
Returns the intervals fitting to all selected data.
bool hasDataPlots() const
Returns true, if the manager contains some data plots.
void applyCoordSys(CoordinateSystem coords, size_t every=1)
Apply the necessary transformation for the selected coordinate system to the managed assets.
void normalize(int t_animate)
Normalize the managed data to be below 1 (or the starting amplitude in an animation).
std::vector< PlotAsset > assets
This class contains all the plot settings usable by the plotting algorithm.
std::string getColorSchemeMedium(const std::string &_sAddOpt="") const
bool getInvertion(int i=0) const
@ STR_BACKGROUNDCOLORSCHEME
bool getRangeSetting(int i=0) const
int getAnimateSamples() const
std::string getGridStyle() const
void setFileName(std::string _sFileName)
Change the output file name.
std::string getCustomTick(int nAxis=0) const
const std::vector< Line > & getHLines() const
const std::vector< Line > & getVLines() const
std::string getColors() const
unsigned short getSlices(unsigned int nDir=0) const
std::string getAxisLabel(size_t axis) const
Return the axis label associated to the selected axis.
const int * getTargetGUI() const
std::string getLineStyles() const
IntervalSet & getRanges()
double getAxisScale(int i=0) const
TimeAxis getTimeAxis(unsigned int i=0) const
void setGlobalComposeParams(const std::string &__sCmd)
double getOrigin(int nDir=0) const
void setParams(const std::string &__sCmd, int nType=ALL)
Identifies parameters and values in the passed parameter string and updates the selected type of the ...
std::string getAxisbind(unsigned int i) const
bool getSettings(LogicalPlotSetting setting) const
int getGivenRanges() const
std::string getColorScheme(const std::string &_sAddOpt="") const
void deleteData(bool bGraphFinished=false)
Delete the internal per-plot data (i.e. weak reset).
double getRotateAngle(int _i=0) const
Axis getAddAxis(unsigned int i=0) const
std::string getTickTemplate(int nAxis=0) const
std::string getColorSchemeLight(const std::string &_sAddOpt="") const
void setAddAxis(unsigned int i, const Interval &_ivl)
void setLocalComposeParams(const std::string &__sCmd)
std::string getFineGridStyle() const
bool getLogscale(size_t i) const
This class handles the complete plotting process.
void createStdPlot(size_t nPlotCompose, size_t nPlotComposeSize)
This member function wraps the creation of all one-dimensional plots (e.g. line or point plots).
double getProjBackground(double dPhi, int nEdge=0)
This member function determines the positions for the projected density and contour maps,...
void applyPlotSizeAndQualitySettings()
This member function determines output size and quality on the plotting target and the plotting param...
void determinePlottingDimensions(const std::string &sPlotCommand)
This member function determines the maximal plotting dimension of the passed command.
mglPoint CalcCutBox(double dPhi, int nEdge=0, int nCoords=0, bool b3D=false)
This member function calculates the two coordinates in space, which describe the cutting box....
void setStyles()
This member function prepares the line and point styles based upon the currently used parameters.
Plot(const Plot &)=delete
void create2dDrawing(std::vector< std::string > &vDrawVector)
This member function handles the creation of all two-dimensional drawings.
~Plot()
Plot class destructor.
IntervalSet secDataRanges
size_t createSubPlotSet(bool &bAnimateVar, std::vector< std::string > &vPlotCompose, size_t nSubPlotStart, size_t nMultiplots[2], size_t &nSubPlots, size_t &nSubPlotMap)
This member function handles the creation of a single subplot, which may be a single plot or part of ...
std::string constructDataLegendElement(std::string &sColumnIndices, const std::string &sTableName)
This member function is used to construct special legend elements.
std::string CoordFunc(const std::string &sFuncDef, double dPhiScale=1.0, double dThetaScale=1.0)
This member function is used to create a coordinate function for the coordinate system,...
FunctionDefinitionManager & _functions
void create3dPlot()
This member function handles the creation of all three-dimensional plots.
void filename(size_t nPlotComposeSize, size_t nPlotCompose)
This member function creates a default plot file name based upon the currently used plotting command.
std::vector< short > m_types
double getLabelPosition(int nCoord)
This member function determines the position of the axis label, which depends on whether a box surrou...
void applyLighting()
This member function applies the light effects to two- or three-dimensional plots....
void extractDataValues(const std::vector< std::string > &vDataPlots)
Creates the internal mglData objects and fills them with the data values from the MemoryManager class...
void displayMessage(bool bAnimateVar)
This member function writes a message to the terminal indicating that the algorithm is currently work...
PlotAssetManager m_manager
void fillData(double dt_max, int t_animate)
This member function calculates the plotting data points from usual expressions.
long getNN(const mglData &_mData)
This member function is a helper to return the number of data points located in the passed mglData ob...
std::string expandStyleForCurveArray(const std::string &sCurrentStyle, bool expand)
This protected member function expands a style string into 9 style string with different luminosities...
std::string getLegendStyle(const std::string &sLegend)
This member function prepares the legend strings to fit the selected legend style (only colours or on...
bool plotstd3d(mglData _mData[3], mglData _mData2[3], const short nType)
This member function creates an actual single three-dimensional trajectory.
void passRangesToGraph()
This member function informs the mglGraph object about the new plotting interval ranges.
void setLogScale(bool bzLogscale)
This member function handles the complex logscale logic applied to the coordinate system of the plot.
size_t countValidElements(const mglData &_mData)
This member function counts the valid data points in the passed mglData object.
void applyColorbar()
This member function applies the colour bar to the plot.
mglPoint createMglPoint(int nCoords, double r, double phi, double theta, bool b3D=false)
This member function creates a mglPoint instance depending on the chosen coordinate system.
void CoordSettings()
This member function applies axes and axis labels to the graph.
std::vector< std::string > separateFunctionsAndData()
This member function separates the functions from the data plots and returns a vector containing the ...
void directionalLight(double dPhi, double dTheta, int nId, char cColor='w', double dBrightness=0.5)
This member function calculates the light source depending on the orientation of the graph....
void create3dDrawing(std::vector< std::string > &vDrawVector)
This member function handles the creation of all three-dimensional drawings.
void defaultRanges(size_t nPlotCompose, bool bNewSubPlot)
This member function applies the default ranges to the plotting ranges.
void createStd3dPlot(size_t nPlotCompose, size_t nPlotComposeSize)
This member function wraps the creation of all trajectory-like plots (plots describing a series of po...
void clearData()
Clearing member function for allocated memory on the heap.
bool plot2d(mglData &_mData, mglData &_mData2, mglData *_mAxisVals, mglData &_mContVec)
This member function creates an actual single two-dimensional plot based upon the current plotting co...
void create2dPlot(size_t nPlotCompose, size_t nPlotComposeSize)
This member function wraps the creation of all all two-dimensional plots (e.g. surface or density plo...
void fitPlotRanges(size_t nPlotCompose, bool bNewSubPlot)
This member function fits the remaining plotting ranges for the calculated interval of data points.
std::string composeColoursForBarChart(long int nNum)
This member function creates a special colour string, which is used for bar charts,...
mglData fmod(const mglData &_mData, double dDenominator)
This member function applies a floating point modulo operator on the data set.
bool createPlotOrAnimation(size_t nPlotCompose, size_t nPlotComposeSize, bool bNewSubPlot, bool bAnimateVar, std::vector< std::string > &vDrawVector, const std::vector< std::string > &vDataPlots)
This member function creates the plot or animation selected by the plotting command.
GraphHelper * createGraphHelper()
void create3dVect()
This member function handles the creation of all three-dimensional vector fields.
void evaluateSubplot(std::string &sCmd, size_t nMultiplots[2], size_t &nSubPlots, size_t &nSubPlotMap)
This member function evaluates the subplot command in a plot composition and determines,...
void create2dVect()
This member function handles the creation of all two-dimensional vector fields.
void applyGrid()
This member function applies the grid with the selected styles to the plot.
bool checkMultiPlotArray(unsigned int nMultiPlot[2], unsigned int &nSubPlotMap, unsigned int nPlotPos, unsigned int nCols, unsigned int nLines)
This member function checks, whether the selected subplot position is still empty.
void prepareMemory()
This member function prepares the memory array in the PlotData class instance to fit the desired plot...
void createDataLegends()
This member function creates the legend strings for the data plots.
bool plotstd(mglData &_mData, mglData &_mAxisVals, mglData _mData2[2], const short nType)
This member function creates an actual single one-dimensional plot based upon the current plotting co...
This class manages the setting values of the internal (kernel) settings of this application.
bool systemPrints() const
Returns, whether system messages shall be printed to the terminal.
bool isDraftMode() const
Returns, whether the plotting draft mode is enabled.
Common exception class for all exceptions thrown in NumeRe.
@ DATAPOINTS_CANNOT_BE_MODIFIED_WHILE_PLOTTING
@ NUMBER_OF_FUNCTIONS_NOT_MATCHING
INSERT HERE.
@ WRONG_PLOT_INTERVAL_FOR_LOGSCALE
static size_t invalid_position
VectorIndex subidx(size_t pos, size_t nLen=std::string::npos) const
This member function returns a subset of the internal stored index just like the std::string::substr(...
void prepend(const std::vector< int > &vVector)
This function will prepend the passed vector before the beginning of the index vector....
int last() const
This member function returns the last index value, which can be reached by the values stored internal...
size_t size() const
This member function returns the size of the indices stored in this class.
bool isOpenEnd() const
This member function determines, whether the internal index set has an open end.
void setRange(int nMin, int nMax)
This member function can be used to force the indices stored internally to be in a defined interval....
std::string to_string() const
This member function converts the vector indexes contents into a human-readable string representation...
int & front()
This member function returns a reference to the first index value stored internally.
size_t numberOfNodes() const
This member function returns the number of nodes describing the index set, which is stored internally...
void SetExpr(StringView a_sExpr)
Set the expression. Triggers first time calculation thus the creation of the bytecode and scanning of...
value_type Eval()
Single-value wrapper around the vectorized overload of this member function.
Mathematical expressions parser.
mu::value_type getDataFromObject(const std::string &sObject, long long int i, long long int j, bool isCluster)
This function returns the data from the selected object and switches automatically between tables and...
DataAccessParser getAccessParserForPlotAndFit(StringView sExpression)
This function will return the access parser instance for the current expression validate,...
string getDataElements(string &sLine, Parser &_parser, MemoryManager &_data, const Settings &_option, int options)
Searches the passed string for calls to any table or cluster and replaces them with internal vectors ...
bool isNotEmptyExpression(const string &sExpr)
This function checks, whether the passed expression is non-empty (i.e. it contains more than white sp...
std::string fromSystemCodePage(std::string)
Transforms the system code page to the internal one.
std::string toSystemCodePage(std::string)
Converts an internal to an external string. Does nothing currently.
size_t findVariableInExpression(const std::string &sExpr, const std::string &sVarName, size_t nPosStart)
This function searches for the selected variable in the passed string and returns the position of the...
unsigned int getMatchingParenthesis(const StringView &)
Returns the position of the closing parenthesis.
std::complex< double > intPower(const std::complex< double > &, int)
This function calculates the power of a value with the specialization that the exponent is an integer...
CONSTCD14 std::enable_if< detail::no_overflow< Period, typenameTo::period >::value, To >::type floor(const std::chrono::duration< Rep, Period > &d)
CONSTCD11 std::chrono::duration< Rep, Period > abs(std::chrono::duration< Rep, Period > d)
CONSTCD14 To ceil(const std::chrono::duration< Rep, Period > &d)
MUP_BASETYPE value_type
The numeric datatype used by the parser.
bool isnan(const value_type &v)
std::vector< double > real(const std::vector< value_type > &vVec)
bool isinf(const value_type &v)
string promptForUserInput(const string &__sCommand)
This function is invoked, if a prompt operator ("??") was found in a string.
void convertVectorToExpression(string &sLine, const Settings &_option)
This function replaces vector expressions with their corresponding multi- expression equation.
static bool isVect3D(const std::string &sCommand)
static void writeTiff(mglGraph *_graph, const string &sOutputName)
This static function uses wxWidgets functionality to add TIFF exporting support to MathGL.
mglData duplicatePoints(const mglData &_mData)
This static function is a fix for the MathGL bug, which connects points outside of the data range.
static bool isVect2D(const std::string &sCommand)
std::string removeQuotationMarks(const std::string &)
This function simply removes the surrounding quotation marks.
DefaultVariables _defVars
static bool isMesh3D(const std::string &sCommand)
static bool isPlot1D(const std::string &sCommand)
static bool isPlot3D(const std::string &sCommand)
static void applyNiceAxis(Interval &ivl, bool isLogarithmic)
Apply the needed interval modification to switch to an optical "nice" and well readable interval.
static mglData scaleSecondaryToPrimaryInterval(const mglData &_mData, const Interval &ivl, const Interval &secIvl)
Simple helper function for Plot::createStdPlot.
static bool isMesh2D(const std::string &sCommand)
static bool hasSecAxisBox(const PlotData &_pData, const PlotInfo &_pInfo)
Static helper function to determine, whether a box is needed due to secondary axes.
static bool isDraw(const std::string &sCommand)
static bool has3DView(const std::string &sCommand)
void createPlot(std::string &sCmd, MemoryManager &_data, mu::Parser &_parser, Settings &_option, FunctionDefinitionManager &_functions, PlotData &_pData)
Wrapper function for creating plots. Will create an instance of the Plot class, which will handle the...
void StripSpaces(std::string &)
Removes leading and trailing white spaces and tabulator characters.
int findParameter(const std::string &sCmd, const std::string &sParam, const char cFollowing)
This function searches the passed parameter in the passed command string. If something is found,...
Structure for the axes in plots.
Structure for the four standard variables.
mu::value_type vValue[4][4]
This structure is central for managing the indices of a table or cluster read or write data access....
This class represents a set of intervals used together for calculations and simulations.
void setNames(const std::vector< std::string > &vNames)
Set the interval names.
std::vector< Interval > intervals
Structure for the horizontal and vertical lines in plots.
A single plot data asset to be plotted. Contains the data, its axes and its type.
This structure governs the needed parameters for plotting.
std::vector< std::string > sLineStyles
int nextStyle() const
Returns the ID of the next style.
std::vector< std::string > sConPointStyles
std::vector< std::string > sPointStyles
std::vector< std::string > sContStyles
long long int intCast(const std::complex< double > &)
Casts the real part of the complex number to an integer and avoids rounding errors.
std::string toString(int)
Converts an integer to a string without the Settings bloat.