我正在研究一个显示cgm图形的程序 . 对于椭圆弧,我得到了开始和结束角度的向量,所以在我计算出角度并尝试在弧形中使用它们之后,我得到了错误的角度 .
在下图中:
-
金线显示我得到的矢量 .
-
红色圆弧是我试图用给定的角度绘制图像的椭圆 .
-
我得到的绿色弧是椭圆变为完美圆形的图像 .
有没有办法可以纠正这个问题?
代码简要介绍:
/*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);
编辑:我发现了我的问题 . 通过假设圆和椭圆的角度相同,我的几何结构已经消失了 . 感谢@KubaOber提到这一点 .
编辑2:我现在需要帮助找到计算椭圆矢量角度的正确公式 . 如果有人可以直接指出我 . 谢谢 .