Comment by jacob_ewing on 13/12/2023 at 17:42 UTC*

3 upvotes, 1 direct replies (showing 1)

View submission: Ask Anything Wednesday - Engineering, Mathematics, Computer Science

What's the fastest way to calculate the points on an arbitrarily oriented ellipse?

I worked out a function ages ago that, given the two focal points and an arbitrary point on the perimeter, provides the two y coordinates for each x-coordinate fed into it. It's a beast though:

https://i.imgur.com/7OKwrNF.png[1][2]

1: https://i.imgur.com/7OKwrNF.png

2: https://i.imgur.com/7OKwrNF.png

(a, b) and (c, d) are the focal points, and (x, y) is any point on the perimeter.

Is there a more efficient way to do it? I've heard people suggest using the classic ellipse function and applying matrix transformations, but never found a good way to use that and intuitively plot an ellipse with point and click operations.

Replies

Comment by bluesbrother21 at 13/12/2023 at 20:37 UTC

4 upvotes, 0 direct replies

To elaborate slightly on the matrix transformation aspect: the thought there is to take the problem from a point on an arbitrarily oriented ellipse (which, as you've noted, is rather difficult) to a point on a much easier to work with ellipse (that is, one aligned with your coordinate axes). This is done by noting that it's a simple frame rotation to go from one ellipse to the other, so you can solve the easier problem and then apply the same rotation to translate the solution to the harder problem.