Calculate point in ellipse given a unit vector

AI Thread Summary
To calculate a point on an ellipse in the direction of a unit vector, the provided formula uses the ellipse's center and radii. However, this method results in a point that is slightly off, leading to incorrect collision detection. The discussion clarifies that the "ellipse radius" refers to the semi-major and semi-minor axes, denoted as a and b in the ellipse equation. An alternative approach involves using the slope from the unit vector and solving for y using the ellipse equation. This method aims to yield a more accurate point on the ellipse for collision detection.
mariano_donat
Messages
8
Reaction score
0
Hi to everyone.

I'm detecting collision between two ellipses. I've got my unit vector, my ellipse center and radius (horizontal and vertical). I want to calculate the point that lies in the ellipse on the direction of the unit vector. See the image attached. Suppose the red arrow is my unit vector and I want to get the coordinates of the green colored point. I'm just multiplying my unit vector times my radius plus the center of the ellipse. The formula looks like this:

Code:
//Assume unit vector has been already calculated at this stage, ellipseCenter and ellipseRadius has been given
Vector pointInEllipse = VectorMake(unitVector.x * ellipseRadius.x + ellipseCenter.x, unitVector.y * ellipseRadius.y + ellipseCenter.y);

The point I get using the above formula lies on the ellipse, but it's translated on both axis a little bit, translated enough to detect collisions when haven't occurred any.
What am I missing here?

Thank you very much in advance.
 

Attachments

  • pointinellipse.png
    pointinellipse.png
    1.2 KB · Views: 589
Mathematics news on Phys.org
I've never heard of an ellipse radius. If the equation of the ellipse is

\frac{x^2}{a^2}+\frac{y^2}{b^2}=1

what quantity represents the "ellipse radius"?
 
I apologize for that, it's a and b from that equation, ellipseRadius.x = a and ellipseRadius.y = b.
 
I have trouble deciphering your syntax in that programming language. But if you have a unit vector you have the slope m. Assuming the picture is translated to the origin, why not just solve y = mx with the equation of the ellipse? A quick calculation seems to show you just need to calculate something like

x=\pm\frac{ab}{\sqrt{m^2+b^2}}
 
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Thread 'Imaginary Pythagoras'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...

Similar threads

Back
Top