Opened 8 years ago

Closed 8 years ago

#3300 closed defect (fixed)

ComputePointOnArc2D in DGNLib not working properly

Reported by: xnaval Owned by: warmerdam
Priority: normal Milestone: 1.7.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: DGN ARC
Cc:

Description

The function ComputePointOnArc2D in the dgnstroke.cpp file is not working properly when the two axis of the ellipse are not equal.

Here is the proposed code for this function :

static void ComputePointOnArc2D( double dfPrimary, double dfSecondary, 
                                 double dfAxisRotation, double dfAngle,
                                 double *pdfX, double *pdfY )

{
    //dfAxisRotation and dfAngle are suposed to be in Radians
    double      dfCosRotation = cos(dfAxisRotation);
    double      dfSinRotation = sin(dfAxisRotation);
    double      dfEllipseX = dfPrimary * cos(dfAngle);
    double      dfEllipseY = dfSecondary * sin(dfAngle);

    *pdfX = dfEllipseX * dfCosRotation - dfEllipseY * dfSinRotation;
    *pdfY = dfEllipseX * dfSinRotation + dfEllipseY * dfCosRotation;
}

Change History (1)

comment:1 Changed 8 years ago by warmerdam

Milestone: 1.7.0
Resolution: fixed
Status: newclosed

The change looks reasonable and I have applied it in trunk (r18382). It could be backported to 1.6 if needed. I have not done any testing other than rerun autotest/ogr/ogr_dgn.py after the change but it presumably does not expand and test any ellipsoidal arcs so it doesn't amount to much in the way of testing.

Thanks!

Note: See TracTickets for help on using tickets.