0

Before I say anything else, let me just state, that I am only in high school and going in Precalculus this upcoming school year, which is probably why I am having this issue in the first place. And if any more information is needed, just let me know!

I am building a game for Android this summer and I am about 2/3 of the way to completion. I'm drawing an ellipse and I can calculate that much, as I know the top-most coordinate, bottom-most coordinate, left-most coordinate, and right-most coordinate. Thus, I also know the width/height as well as the center. However, the ellipse isn't drawn completely, but rather only from a start angle to a "sweep" angle. So let's say that I draw only 100° of the ellipse, from 20 degrees to 120 degrees, which causes a resulting arc, as described here. And so, is it possible to modify the algebraic standard equation of an ellipse(e.g. $(x-h)^2\over a^2$ + $(y-k)^2\over b^2$ = 1) in order to select only a given portion of it using a specified range of degree in order to select the arc, and from there find the corresponding y value to a known x (e.g (200, y?)). However, if there is another method that would make it substantially easier or more efficient, then I just ask that the most detail possible be given so that I could implement it into code.

What I am trying to achieve, in essence.

1 Answers1

0

If your angle is $\theta$ you know $(y-k)/(x-h) = \tan{\theta}$ or $x-h = (y-k)/\tan{\theta}$. Plug this into your equation for your ellipse to get

$\displaystyle \frac{(y-k)^2}{(a\tan{\theta})^2}+\frac{(y-k)^2}{b^2}=1$

So there you have an equation that you can solve readily for $y-k$. Just be careful about which quandrant of the plane you are in.

  • Thank you! As this is going to be displayed on a screen, the coordinates should always be displayed in quadrant 1. – David Kluszczynski Jul 13 '16 at 18:24
  • And where does the angle $\theta$ start? – David Kluszczynski Jul 13 '16 at 18:25
  • $\theta$ starts on the x-axis. If you want a section of arc between two angles, do the above calculation for both angles and plot the ellipse in between the two angles. – bob.sacamento Jul 13 '16 at 18:57
  • Sorry, last question. Is there a way to numerically combine the two resulting equations, like these two: y = $25(25/2(tan(25))\over 2$ + 50 and y = $25(25/2(tan(130))\over 2$ + 50 (provided I solved them correctly lol). This is because this equation is meant for the movement of an object. Or would it be simpler to just continually solve the equation but for a changing angle in order to simulate the movement that the object should take? – David Kluszczynski Jul 13 '16 at 19:25
  • If I understand your question, I don't see any further combining that can be done. I think continually solving for a changing angle would be the way to go, unless this slows your code down too much. – bob.sacamento Jul 13 '16 at 20:02
  • Thank you so much then! I'll implement the continually solving, but it shouldn't be tremendously taxing, as our modern cell phone are so incredibly powerful and I already configured my code so that calculations aren't done continuously, but rather at discrete intervals, which should make this implementation even less taxing. But once again, thank you so much for the time and effort! – David Kluszczynski Jul 13 '16 at 20:20