[..] La fonction [shq] drawlineshq
Code
int drawline_shq_xpl(){
scltracefa(§, ƒ, ∅);
scltracefc("scl-%s (%s) : %s\n\n", sclver(), sclsec(), temps_char(0));
const int pn = 103; // nombre de points
int pi;
const int dn = 3; // dimension d'un point
const double xStep = 0.01;
std::vector< double > vect_x;
std::vector< double > vect_y;
std::vector< std::vector<double> > pointp;
std::vector<double> point(dn);
double **pointq = newmat<double>(pn, dn);
double **pointl = newmat<double>(pn, dn);
double **pointh = newmat<double>(pn, dn);
double **pointt = newmat<double>(pn, dn);
for (pi=0; pi<pn; ++pi){
const double x = xStep * pi;
point[0] = x;
point[1] = cos(x);
point[2] = sin(x);
pointp.push_back(point);
vect_x.push_back(x);
vect_y.push_back(sin(x));
pointq[pi][0] = x;
pointq[pi][1] = cos(x)*cos(x);
pointq[pi][2] = sin(x)*sin(x);
pointl[pi][0] = x;
pointl[pi][1] =-cos(x)*cos(x);
pointl[pi][2] = sin(x)*sin(x);
pointh[pi][0] = x;
pointh[pi][1] =-cos(x)*cos(x);
pointh[pi][2] =-sin(x)*sin(x);
pointt[pi][0] = x;
pointt[pi][1] = cos(x)*cos(x);
pointt[pi][2] =-sin(x)*sin(x);
}
std::string jsoname=std::string(ƒ)+".json",
jsonpath="./srt/"+jsoname;
shq::beginDrawing(/*jsonpath*/);// <Initializes the "connection"
shq::newFigure("drawline_shq"); // <Creates a new figure;
shq::drawLine(pointp,"taupe");
shq::drawLine(pn, 3, pointq, "carotte");
shq::drawLine(pn, 3, pointl, "bleu");
shq::drawLine(pn, 3, pointh, "chaire");
shq::drawLine(pn, 3, pointt, "vert");
shq::drawLine(vect_x,vect_y, "mauve");
shq::axisAuto();
/*shq::setFigureProperties("drawline_shq",
shaqParams("x",0,"y",220,"width",450,"height",100));*/
std::vector<std::string> labels;
labels.push_back("[dim-1]"); labels.push_back("[dim-2]"); labels.push_back("[dim-3]");
shq::axisLabels(labels);
shq::saveImage("./srt/drawline_shq.svg");
shq::endDrawing(); // <Closes the "connection"
scltracefe(§, ƒ, ∅);
return 0;
}
/* ƒ décorée par le 01-04-2024 16:22:21 */
Sortie
[>..\xpl\src\sclgraf.shq.xpl.cpp.drawline_shq_xpl]
scl-24.04 (gwin64) : 01-04-2024 16:22:21
[<..\xpl\src\sclgraf.shq.xpl.cpp.drawline_shq_xpl]