Opened 17 months ago
Closed 16 months ago
#6971 closed defect (fixed)
DXF: Cannot import hatches with boundaries that contain elliptical arcs
Reported by: | Alan Thomas | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | dxf |
Cc: |
Description
The importation of hatch entities with elliptical arcs in their boundaries is completely broken:
- The ratio of minor axis to major axis is incorrectly interpreted by OGR as a percentage between 0 and 100, where it is actually a ratio between 0 and 1.
- In AutoCAD, "start angle" and "end angle" refer to circular angles. OGR is incorrectly interpreting these values as elliptical angles, or parameters.
Given the common code, it's possible that the DWG format also has these issues (although I haven't tested that).
The specification (http://images.autodesk.com/adsk/files/autocad_2014_pdf_dxf_reference_enu.pdf, PDF page 111, numbered 103 in document) is admittedly vague, but the problems are obvious when you export a DXF from AutoCAD and try reading it into OGR.
Attachments (3)
Change History (6)
Changed 17 months ago by
Attachment: | elliptical-arc-hatch.png added |
---|
Changed 17 months ago by
Attachment: | elliptical-arc-hatch.dxf added |
---|
Sample DXF file with elliptical arc on hatch boundary
comment:1 Changed 17 months ago by
@atlight What is the rationale for the "180.0 * floor ( ( dfStartAngle + 90 ) / 180 )" term in the formula that converts from circular to elliptical angles ?
comment:2 Changed 16 months ago by
@Even: This part of the formula:
atan( ( 1.0 / dfRatio ) * tan( dfEndAngle * M_PI / 180 ) )
always returns an angle between -90 and 90 degrees. The term
180.0 * floor ( ( dfStartAngle + 90 ) / 180 )
returns a multiple of 180, which is added on in order to give the correct result.
If you know a clearer formula to convert circular to elliptical angles, please feel free to substitute that :)
Screenshot of the example DXF file