PDA

View Full Version : Equidistant points along a QGraphicsEllipseItem



brcain
25th November 2014, 22:36
Hello,

Is there anything in Qt that would enable me to calculate equidistant points around an instance of QGraphicsEllipseItem?
I thought the QGraphicsEllipseItem implementation might shed some light on the problem.

Please forgive if this is more of a math / computational geometry forum question (e.g. answer being to use elliptic integrals).
Nonetheless, many thanks for suggestions that come to mind.

Thanks,
Ben

ChrisW67
26th November 2014, 12:03
Equal distance along the circumference, equal subtended angles at the centre, or even equal angles at a focus of the ellipse?

brcain
26th November 2014, 16:03
Equidistant points along the circumference of the ellipse ... not equal angles. Near equidistant points would even suffice.
This is not a trivial computation for an ellipse, so I was hoping Qt provided some solution since they obviously render the ellipse properly.

ChrisW67
26th November 2014, 22:20
Unfortunately, drawing an ellipse using a Bresenham-style algorithm is much easier than computing the circumference. The Qt arc functions all work on the central angle if memory serves.

For a near circular ellipse equal angles would be a close approximation. There may be some method using equally spaced points on an auxiliary circle and then mapping them back to the ellipse but I cannot point to it. Something like that happens in the Vincenty methods for working with an ellipsoidal world: the geometry is mapped to an auxiliary sphere, maths done with spherical geometry, and an iterative method used to return to the ellipsoid. You would need the equivalent of the last step.

brcain
26th November 2014, 22:36
Thanks much for the feedback. Elliptic calculations aren't generally closed form.
When I get the elliptic integral solution working I'll post the example here if any are interested.