I'm working on a program which is displaying cgm graphics. For an elliptical arc, I get vectors to the start and end angles so after I calculate the angles and try to use them in an arc, I am getting the wrong angles drawn.
In the image below :
- The gold lines show the vectors I get.
- The red arc is the ellipse I get trying to draw the image with the angles given.
- The green arc which I get is the image with the ellipse changed to a perfect circle.
Is there a way I can correct this?
Brief exapme of code:
/*213 and 113 are the angles calculated from the vectors from the center blue mark at(300, 200) to the points (-75, -50) and (75, -50) which are shown by the dark yellow lines*/
QPainter p;
//draw elliptical arc
p.drawPie(200,150, 200, 100, 213*16, 113*16);
//draw circular arc
p.drawPie(250,150, 100, 100, 213*16, 113*16);
edit: I found my issue. My geometry was off by assumming the angle was the same for circles and ellipses. Thanks to @KubaOber for mentioning that.
edit 2: I am now in need of assistance in finding the correct formula for calculating the angle ot the vector for an ellipse. If someone can point me in the correct direct. Thanks.