Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DXF Parser : Ellipses angle direction

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:

Ellipse1Ellipse2

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...

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

Ellipse3

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

Did I miss a group code or something ?

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)

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

like image 892
ingham Avatar asked Jan 23 '12 14:01

ingham


1 Answers

Solved: I forgot to take in account the extrusion vector

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

like image 160
ingham Avatar answered Sep 19 '22 12:09

ingham