It had to be transformed

So I struggled today to correct the implementation of ellipse we had done previously. Deploying QPainterPath for painting now, the ellipse got its axis parallel to the principal coordinate axes, no matter what was the position of clicks with respect to one another. The two cases are shown below though the tilted one has glitches. The angle of the line connecting center and the point giving major radius mattered.


Yeah ellipse is a case of circle or it could be vice-versa but orientation affected the shape of ellipse. For it to be correct, the computation of angle had to be done. Did it but why the ellipse did not rotate? Manipulated the angles: start angle and span angle. Added the angle to both but common sense told it won’t alter anything. For a test, instead of a span of 360 degrees, reduced span angle and yes it was working.

Whoopee! It struck me. The coordinate system’s origin was translated to the center of the ellipse, rotated about an angle == angle between major axis and the original x-axis and then re-translated to its prime┬áposition. And it worked! Can be seen in figure above. So unlike the previous implementation, where we did not had any tilted ellipses, that issue was solved today. The minimal bounding rectangle needs to be figured out yet.