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

查看:526
本文介绍了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...

我错过了团体代码吗?

信息:在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天全站免登陆