各位有没有用GDI画圆弧的时候画得不准确的情况

JasonCharlesBourne 2013-08-05 09:14:11
我用GDI画一个半径很大(2132.654)起始角(359.454)和终止角(0.36)很接近的一个圆弧时会多出来一些无效的线段。
如图:红色框起来的为多余的线段
...全文
152 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
JasonCharlesBourne 2013-08-05
  • 打赏
  • 举报
回复
引用 6 楼 schlafenhamster 的回复:
看看你怎么改的。
你自己建一个空文档用我给的数据画出来试试,貌似也会出错
JasonCharlesBourne 2013-08-05
  • 打赏
  • 举报
回复
CRect _rc = LPtoDP_Rect(rcBound_); // top:-7276 bottom:7843 left:-14559 right:559 CPoint _ptS = LPtoDP_Point(ptStart_);// x:559 y:356 CPoint _ptE = LPtoDP_Point(ptEnd_); // x:559 y:237 return CDC::Arc(_rc, _ptS, _ptE); 我发现,只要起始角和终止角之间经过0度就会画出多余的线,起始角和终止角都小于0或者都大于0(即使矩形长宽大于32767)就不会有问题
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
看看你怎么改的。
JasonCharlesBourne 2013-08-05
  • 打赏
  • 举报
回复
我把矩形的长、宽改成小于32767还是会这样
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
“Both the width and height of the rectangle must be greater than 2 units and less than 32,767 units.”
JasonCharlesBourne 2013-08-05
  • 打赏
  • 举报
回复
引用 2 楼 iloveiverson 的回复:
[quote=引用 1 楼 schlafenhamster 的回复:] 我们看看代码
最终到画的时候代码是这样的,注释的部分为变量的值。 CRect _rc = LPtoDP_Rect(rcBound_); // top:-19886 bottom:20440 left:-39775 right:552 CPoint _ptS = LPtoDP_Point(ptStart_);// x:551 y:469 CPoint _ptE = LPtoDP_Point(ptEnd_); // x:551 y:150 return CDC::Arc(_rc, _ptS, _ptE); 画出来就是图上的样子[/quote] MSDN上面写:Since an arc is not a closed figure, it is not filled. Both the width and height of the rectangle must be greater than 2 units and less than 32,767 units. 说不能小2大于32767,但是没看懂为什么要这样
JasonCharlesBourne 2013-08-05
  • 打赏
  • 举报
回复
引用 1 楼 schlafenhamster 的回复:
我们看看代码
最终到画的时候代码是这样的,注释的部分为变量的值。 CRect _rc = LPtoDP_Rect(rcBound_); // top:-19886 bottom:20440 left:-39775 right:552 CPoint _ptS = LPtoDP_Point(ptStart_);// x:551 y:469 CPoint _ptE = LPtoDP_Point(ptEnd_); // x:551 y:150 return CDC::Arc(_rc, _ptS, _ptE); 画出来就是图上的样子
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
我们看看代码
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
我画了个图:
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
“The arc is drawn in a counterclockwise direction. ” 圆弧 总是 逆时针 画。 是不是影响了 有效宽度
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
终点和起点 换一换 看看: BOOL bl=dc.Arc(_rc, _ptE, _ptS);//TRUE
JasonCharlesBourne 2013-08-05
  • 打赏
  • 举报
回复
引用 10 楼 schlafenhamster 的回复:
就是说 椭圆太扁, 你 又 要 画 半个圆以上 的 圆弧,就会 看上去 这样。
top:-7276 bottom:7843 left:-14559 right:559 这个矩形不扁吧~~~~~~
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
就是说 椭圆太扁, 你 又 要 画 半个圆以上 的 圆弧,就会 看上去 这样。
schlafenhamster 2013-08-05
  • 打赏
  • 举报
回复
不是错误,是因为 椭圆太扁:

19,469

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧