Calculate point in ellipse given a unit vector

In summary, the conversation is about detecting collisions between two ellipses using a unit vector, ellipse center, and ellipse radius. The goal is to calculate the coordinates of a point on the ellipse in the direction of the unit vector. The formula for this calculation is provided, but it seems to be translating the point on both axes. The conversation also briefly touches on the equation of an ellipse and the use of a and b as ellipse radius values. An alternative approach is suggested using the slope of the unit vector and the equation of the ellipse.
  • #1
mariano_donat
8
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: 527
Mathematics news on Phys.org
  • #2
I've never heard of an ellipse radius. If the equation of the ellipse is

[tex]\frac{x^2}{a^2}+\frac{y^2}{b^2}=1[/tex]

what quantity represents the "ellipse radius"?
 
  • #3
I apologize for that, it's a and b from that equation, ellipseRadius.x = a and ellipseRadius.y = b.
 
  • #4
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

[tex]x=\pm\frac{ab}{\sqrt{m^2+b^2}}[/tex]
 
  • #5


Hello, it seems like you are on the right track with your formula. However, there may be a few things that could be causing the translation in your calculations.

First, make sure that your unit vector is normalized, meaning its magnitude is equal to 1. If it is not, you may need to divide the vector components by its magnitude before multiplying by the radius.

Another possibility is that your ellipse center and radius values are not accurate or consistent. Double check that these values are correct and match up with the image you have provided.

Lastly, check if your coordinate system is consistent. It could be that your unit vector and ellipse center are using different coordinate systems, resulting in the translation you are seeing. Make sure to use the same coordinate system for all calculations.

I hope this helps and good luck with your collision detection!
 

1. How do you calculate a point in an ellipse given a unit vector?

To calculate a point in an ellipse given a unit vector, you will need to first determine the center point and the semi-major and semi-minor axes of the ellipse. Then, you can use the equation (x,y) = (xcosθ – ysinθ, xsinθ + ycosθ) to find the point on the ellipse, where θ is the angle between the unit vector and the x-axis.

2. What is a unit vector?

A unit vector is a vector with a magnitude of 1 and is used to represent direction in a specific coordinate system. It is commonly used in mathematics and physics to simplify calculations and represent physical quantities in a more concise manner.

3. Can a point be outside of an ellipse given a unit vector?

Yes, it is possible for a point to be outside of an ellipse given a unit vector. This can occur if the unit vector is pointing in a direction that is outside of the ellipse's boundary. In this case, the point will not lie on the ellipse, but instead, be located somewhere outside of it.

4. How do you determine the semi-major and semi-minor axes of an ellipse?

The semi-major and semi-minor axes of an ellipse can be determined by finding the distance from the center point to the furthest point on the ellipse in the x and y direction, respectively. These distances are known as the semi-major and semi-minor axes and are used in the equation (x,y) = (xcosθ – ysinθ, xsinθ + ycosθ) to calculate a point on the ellipse.

5. What other factors can affect the position of a point in an ellipse?

In addition to the unit vector, the position of a point in an ellipse can also be affected by the eccentricity of the ellipse, which is a measure of how elongated or circular the ellipse is. A higher eccentricity will result in a more elongated ellipse and may cause the point to be further from the center. Additionally, the angle between the unit vector and the x-axis, as well as the center point of the ellipse, can also impact the position of a point on the ellipse.

Similar threads

Replies
4
Views
817
Replies
6
Views
1K
Replies
2
Views
2K
  • General Math
Replies
11
Views
1K
  • General Math
Replies
3
Views
2K
Replies
7
Views
5K
Replies
2
Views
1K
Replies
3
Views
1K
  • General Math
Replies
20
Views
1K
Replies
5
Views
1K
Back
Top