how to draw a star ??
Unsolved
General and Desktop
-
I'm trying to draw a star BUT it doesn't work out for me.
I have a formula. But I still have no idea how to embed it in my code.
all I could do was a circle or 3 loops.
struct strKryg { strKryg() { R = 0.0; kol_toch = 0; tocka_1 = 0; tocka_2 = 0; X = 0.0; Y = 0.0; integerVector.clear(); } float R; // радиус int kol_toch; // колич точек которые будут формировать круг int tocka_1; // точка выреза начало int tocka_2; // точка выреза конец float X; float Y; // расположение икса и игрика QVector<float> integerVector; // вектор куда кладём точки (Х и У) }; .... _mytKrg.integerVector.append(_mytKrg.X + (_mytKrg.R * cos(grad_kol_toch*M_PI*3/180.0)+_mytKrg.R * cos(grad_kol_toch*M_PI*5/5*180.0))); _mytKrg.integerVector.append(_mytKrg.Y + (_mytKrg.R * sin(grad_kol_toch*M_PI/180.0))); .... painter.drawPoint(QPointF(_mytKrg.integerVector[_mytKrg.tocka_1],_mytKrg.integerVector[_mytKrg.tocka_2]));
is there any book about how to draw with formulas (preferably on qt) ??