[..] La fonction [shq] drawpolygonshq
Code
int drawpolygon_shq_xpl(){
scltracefa(§, ƒ, ∅);
scltracefc("scl-%s (%s) : %s\n\n", sclver(), sclsec(), temps_char(0));
std::string jsoname=std::string(ƒ)+".json",
jsonpath="./srt/"+jsoname;
shq::beginDrawing(/*jsonpath*/); // <Initializes the "connection"
shq::newFigure("drawpolygon_shq"); // <Creates a new figure
shq::newGroup("Du Gwer","k[t]");
shq::newGroup("Goz Treuz","p[z]");
shq::newGroup("Du Melen","k[q]");
shq::newGroup("Du Glaz","k[l]");
shq::newGroup("Du Ruz","k[h]");
double e=1, xd=7*e, xd_2=xd/2, yd_2=e/*, yd=2.0*yd_2*/;
std::vector<double> x0, y0;
x0.push_back( xd_2); y0.push_back( 0);
x0.push_back( xd_2-yd_2); y0.push_back( yd_2);
x0.push_back(-(xd_2-yd_2)); y0.push_back( yd_2);
x0.push_back(- xd_2); y0.push_back( 0);
x0.push_back(-(xd_2-yd_2)); y0.push_back(-yd_2);
x0.push_back( xd_2-yd_2); y0.push_back(-yd_2);
x0.push_back( xd_2); y0.push_back( 0);
shq::drawPolygon(x0, y0, shq::Params("group","Du Gwer"));
std::vector<double> x1, y1;
x1.push_back( xd_2); y1.push_back( 0);
x1.push_back( xd_2+yd_2); y1.push_back( yd_2);
x1.push_back( xd_2+yd_2); y1.push_back( yd_2+(xd-2*e));
x1.push_back( xd_2); y1.push_back( yd_2+(xd-e));
x1.push_back( xd_2-yd_2); y1.push_back( yd_2+(xd-2*e));
x1.push_back( xd_2-yd_2); y1.push_back( yd_2);
x1.push_back( xd_2); y1.push_back( 0);
shq::drawPolygon(x1, y1, shq::Params("group","Goz Treuz"));
std::vector<double> x2, y2;
x2.push_back( xd_2); y2.push_back( 0 +yd_2+(xd-e));
x2.push_back( xd_2-yd_2); y2.push_back( yd_2+yd_2+(xd-e));
x2.push_back(-(xd_2-yd_2)); y2.push_back( yd_2+yd_2+(xd-e));
x2.push_back(- xd_2); y2.push_back( 0 +yd_2+(xd-e));
x2.push_back(-(xd_2-yd_2)); y2.push_back(-yd_2+yd_2+(xd-e));
x2.push_back( xd_2-yd_2); y2.push_back(-yd_2+yd_2+(xd-e));
x2.push_back( xd_2); y2.push_back( 0 +yd_2+(xd-e));
shq::drawPolygon(x2, y2, shq::Params("group","Du Melen"));
std::vector<double> x3, y3;
x3.push_back( xd_2 -xd); y3.push_back( 0);
x3.push_back( xd_2+yd_2-xd); y3.push_back( yd_2);
x3.push_back( xd_2+yd_2-xd); y3.push_back( yd_2+(xd-2*e));
x3.push_back( xd_2 -xd); y3.push_back( yd_2+(xd-e));
x3.push_back( xd_2-yd_2-xd); y3.push_back( yd_2+(xd-2*e));
x3.push_back( xd_2-yd_2-xd); y3.push_back( yd_2);
x3.push_back( xd_2 -xd); y3.push_back( 0);
shq::drawPolygon(x3, y3, shq::Params("group","Du Glaz"));
std::vector<double> x4, y4;
x4.push_back( xd_2 -xd); y4.push_back( 0 -xd);
x4.push_back( xd_2+yd_2-xd); y4.push_back( yd_2 -xd);
x4.push_back( xd_2+yd_2-xd); y4.push_back( yd_2+(xd-2*e)-xd);
x4.push_back( xd_2 -xd); y4.push_back( yd_2+(xd-e)-xd);
x4.push_back( xd_2-yd_2-xd); y4.push_back( yd_2+(xd-2*e)-xd);
x4.push_back( xd_2-yd_2-xd); y4.push_back( yd_2 -xd);
x4.push_back( xd_2 -xd); y4.push_back( 0 -xd);
shq::drawPolygon(x4, y4, shq::Params("group","Goz Treuz"));
std::vector<double> x5, y5;
x5.push_back( xd_2); y5.push_back( 0 -yd_2-(xd-e));
x5.push_back( xd_2-yd_2); y5.push_back( yd_2-yd_2-(xd-e));
x5.push_back(-(xd_2-yd_2)); y5.push_back( yd_2-yd_2-(xd-e));
x5.push_back(- xd_2); y5.push_back( 0 -yd_2-(xd-e));
x5.push_back(-(xd_2-yd_2)); y5.push_back(-yd_2-yd_2-(xd-e));
x5.push_back( xd_2-yd_2); y5.push_back(-yd_2-yd_2-(xd-e));
x5.push_back( xd_2); y5.push_back( 0 -yd_2-(xd-e));
shq::drawPolygon(x5, y5, shq::Params("group","Du Ruz"));
std::vector<double> x6, y6;
x6.push_back( xd_2 ); y6.push_back( 0 -xd);
x6.push_back( xd_2+yd_2); y6.push_back( yd_2 -xd);
x6.push_back( xd_2+yd_2); y6.push_back( yd_2+(xd-2*e)-xd);
x6.push_back( xd_2 ); y6.push_back( yd_2+(xd-e)-xd);
x6.push_back( xd_2-yd_2); y6.push_back( yd_2+(xd-2*e)-xd);
x6.push_back( xd_2-yd_2); y6.push_back( yd_2 -xd);
x6.push_back( xd_2 ); y6.push_back( 0 -xd);
shq::drawPolygon(x6, y6, shq::Params("group","Du Glaz"));
shq::axisAuto("drawpolygon_shq");
shq::axisEqual("drawpolygon_shq");
shq::axisLabels("[m]", "[m]", "drawpolygon_shq");
shq::saveImage("./srt/drawpolygon_shq.svg");
shq::endDrawing(); // <Closes the "connection"
scltracefe(§, ƒ, ∅);
return 0;
}
/* ƒ décorée par le 01-04-2024 16:00:55 */
Sortie
[>..\xpl\src\sclgraf.shq.xpl.cpp.drawpolygon_shq_xpl]
scl-24.03 (gwin64) : 01-04-2024 16:00:55
[<..\xpl\src\sclgraf.shq.xpl.cpp.drawpolygon_shq_xpl]