DXF 解析器:椭圆角度方向 [英] DXF Parser : Ellipses angle direction

查看:27
本文介绍了DXF 解析器:椭圆角度方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了自己的 ASCII DXF 文件解析器,但在某些特定文档中遇到了省略号的问题.

I wrote my own ASCII DXF file parser and I encounter a problem with ellipses in some particular documents.

似乎没有定义开始和结束参数的角度方向(顺时针或逆时针)的组代码".在大多数情况下,它是逆时针的,但并非在所有情况下...

It seems that there is no "Group Code" defining the angle direction (Clockwise or Counterclockwise) for Start and End Parameters. In most case, it's counterclockwise, but not in ALL cases...

为了简化,这里有一个直观的例子:

To simplify, here is a visual exemple:

如您所见,第一个的起始角为 135,第二个的起始角为 45...但是,椭圆似乎是相同的(半圆,在左边)...这是因为第一个的角度是顺时针的,第二个的角度是逆时针的...

As you can see, the first one has a start angle of 135, and the second one a start angle of 45... But, the ellipses seems to be identical (half-circle, on the left)... This is because the first one's angles are clockwise, and the second one's are counter-clockwise...

显然,它们在 AutoCAD 中正确显示,但使用我的解析器,它们显示如下:

Obviously, they appear correctly in AutoCAD, but with my parser, they appear like that:

只是因为我不知道角度是用顺时针还是逆时针表示...

Simply because I don't know if angles are represented CW or CCW...

我是不是遗漏了群号之类的东西?

Did I miss a group code or something ?

信息:在 AutoCAD 中,我可以看到第一个椭圆Minor Axis Endpoint"是 [200, -200, 0],而第二个是 [-200, 200, 0],我想这就是 AutoCAD知道角度是 CW 还是 CCW ......但我在 DXF 文件中只有长轴端点"和长短轴比"(一个数字)

Info: In AutoCAD, I can see that the first ellipse "Minor Axis Endpoint" is [200, -200, 0], while the second one's is [-200, 200, 0], I suppose this is how AutoCAD knows if the angles are CW or CCW... But all I have in the DXF file is the "Major Axis Endpoint" and the "Major to Minor Axis Ratio" (a number)

这是与此示例对应的 DXF 文件:http://www.woofiles.com/dl-279966-ZvoMjamr-c.dxf

Here is the DXF file corresponding to this example: http://www.woofiles.com/dl-279966-ZvoMjamr-c.dxf

推荐答案

已解决:忘记考虑挤压向量

Solved: I forgot to take in account the extrusion vector

当它为负数 (0,0,-1) 时,角度必须被视为 CCW 而不是 CW(反之亦然)

When it is negative (0,0,-1), the angles must be treated as CCW instead of CW (and vice-versa)

这篇关于DXF 解析器:椭圆角度方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆