Unsolved [QT][QML][C++] Draw an interpolated polygon using C++ painter
-
@Shadow-01
Hi
super with picture.
But did you try the RoundedPolygon class from the link?It does sort of round the edges of a polygon so might look ok and hits the points.
-
Something like spline interpolation?!
This example is for
QChart
but maybe you can use spline interpolation for your polygon. -
@mrjj Thanks; rounded polygon doesn't exist under the item that QT creator suggested me in the list of figure I can draw; should I import something special? Or, have you an example?
Thanks again for your time!
-
@Pl45m4 Thanks but not; this is not the way; as told in my question, I already tried but it works only in a chart. And I should draw a free polygon outside a chart. Any other idea?
(No, SPline in a drawPolyline give an error; only under a chart I can use it).
-
@Shadow-01 said in [QT][QML][C++] Draw an interpolated polygon using C++ painter:
thanks; rounded polygon doesn't exist under the item that QT creator suggested me in the list of figure I can draw; should I import something
Yes, the link has a that class in the bottom. ITs not a default Qt one.
The effect sounds like what you want.
but might end being too round. I have not tried it with a shape like yours.
-
@mrjj Wait, for sure the line touch the edge? It seems not. It is Bezier algorythm? From the page, it seems so..
-
@mrjj Thanks but for sure is not the way. My solution should absolutely touch the edge (given points), otherwise the line is not correct. Other solutions? Thanks for your time!
-
@Shadow-01
Hi
but look at the airplane. it does touch the edges.
Outside of such rounded polygon im not sure what to use. -
No, unfortunately don't touch. If you see the internal vertical segment of each engine, is for sure longer in the left one. Anyway, thanks. :-(
-
@Shadow-01 said in [QT][QML][C++] Draw an interpolated polygon using C++ painter:
(No, SPline in a drawPolyline give an error; only under a chart I can use it).
Read my answer again.
I know that you can't useQSplineSeries
outside ofQChart
but you should take a took at it (spline interpolation) and the Wikipedia page, I linked.If there's nothing like this in Qt you have to draw it yourself using mathematics.
-
Thanks all so much. I found a solution, by using the Bezier Algorithm with a really small curve factor number. The result is almost the same as desired.
-
@Shadow-01
You could show an image of the final result :) 🙄
So did you use code from link or did you make some yourself ?