I am developing a DXF parser by using the dxflib library. I have a problem parsing ellipses.
When I parse an ellipse I receive the following data:
struct DL_EllipseData
{
/*! X Coordinate of center point. */
double cx;
/*! Y Coordinate of center point. */
double cy;
/*! X coordinate of the endpoint of the major axis. */
double mx;
/*! Y coordinate of the endpoint of the major axis. */
double my;
/*! Ratio of minor axis to major axis. */
double ratio;
};
I am trying to compute the angle by using the following equation:
auto angle = std::atan2(ellipse.my, ellipse.mx);
But it gives me wrong outcomes (for example if the angle is 16 degrees it gives to me about 74 degrees).
How should I compute properly the rotation angle?