Parametrizing an ellipse - what am I doing wrong?

  • Thread starter abeall
  • Start date
  • Tags
    Ellipse
In summary, the conversation discusses the process of parametrizing an ellipse and finding the point of intersection between an angle/vector and the ellipse perimeter. The formula used for this purpose is x = center.x + ellipse.width/2 * Math.cos(angleR) and y = center.y + ellipse.height/2 * Math.sin(angleR). However, this formula only works accurately at 90 degree angles and is not accurate for more elliptical shapes. The conversation then delves into the issue of the angleR parameter not matching the angle from the center to the point (x,y) on the ellipse. An alternative equation, r = 0.5 / sqrt( (cos(angleR)/ellipse.width)^2 + (sin(angleR)/ellipse
  • #1
abeall
21
0
parametrizing an ellipse -- what am I doing wrong?

I have the width, height, and center point of the ellipse. I have an angle/vector from the center point and I want to know at what point it intersects the ellipse perimeter. Based on this wikipedia article:
http://en.wikipedia.org/wiki/Ellipse

I implemented this formula (Flash ActionScript):

x = center.x + ellipse.width/2 * Math.cos(angleR)
y = center.y + ellipse.height/2 * Math.sin(angleR)

angleR is achieved like this:

Math.atan2(p2.y - p1.y, p2.x - p1.x);

p1 is the ellipse center point, and p2 is the X object that follows your cursor in the Flash example.

Here is the result:
http://abeall.com/files/temp/ellipse.swf

It is only correct at 90 degree angles. What am I doing wrong?

To describe what's going wrong in the Flash example a little more clearly:
The X which follows your cursor represents my a target point to create the vector/angle from the ellipse center point. The blue line is drawn and the angle is measured at the top as radian(left) and degree(right). The radian value as shown there is what is used in the equation above, angleR. The resulting x,y point is shown in the Flash as a small blue box on the ellipse perimeter. As you can see, it does not line up with the original vector. If I draw a red line between the center and the perimeter x,y and measure the angle, the resulting values are shown under "Resulting Angle" in the Flash, again with radian to the left and angle to the right. The results just doesn't line up.

NOTE: when the shape is a circle, it works at every angle. The more elliptical it is, the less accurate the areas between 90 degrees become.
 
Last edited:
Mathematics news on Phys.org
  • #2
what are the p2 and p1?
 
  • #3
Oops, pardon me, in this case p1 is the ellipse center point, and p2 would be the X object that follows your cursor in the Flash example.
 
  • #4
well in the one case you have a vector whose endpoint has gone a certain distance, say some number of radians around the ellipse. and you have another vector whose angle with a line going through the center is the same as the distance the other point has gone around the ellipse. I'm not positive these lines have to be parallel.

to be explain better, an example:

when the blue line makes an angle of pi/4, that means the blue box has gone pi/4 radians around the ellipse. let's assume the ellipse is centered at the origin. that means it's coordinates are (acos(pi/4),bsin(pi/4). however, the angle of this vector is not in the general case equal to the angle of the blue line. however in the case of the circle, it would be.
 
Last edited:
  • #5
I think I figured it out. I plotted points around the perimeter and realized that the parameter angleR in the parametric equation for an ellipse doesn't correspond to the angle from the center to the point (x,y) on the ellipse. So I looked for another equation and found this to be the answer:

r = 0.5 / sqrt( (cos(angleR)/ellipse.width)^2 + (sin(angleR)/ellipse.height)^2 )
x = center.x + r*cos(angleR)
y = center.y + r*sin(angleR)

Seems to work:
http://abeall.com/files/temp/ellipse.swf
(clear browser cache)
 

1. What is parametrization of an ellipse?

Parametrization of an ellipse is a way to describe and plot points on an ellipse using parameters such as angle or time.

2. Why is parametrization useful for an ellipse?

Parametrization allows for a more simplified and efficient way to describe and manipulate an ellipse. It also allows for easier calculations and plotting of points on the ellipse.

3. What is the standard parametrization of an ellipse?

The standard parametrization of an ellipse is x = a cos(t) and y = b sin(t), where a and b are the lengths of the semi-major and semi-minor axes of the ellipse, and t is the parameter.

4. How do I know if I'm parametrizing an ellipse correctly?

If you are using the standard parametrization and your plotted points fall on the ellipse, then you are likely parametrizing correctly. You can also check for symmetry and make sure your parameters are following the correct range for the ellipse.

5. What are some common mistakes when parametrizing an ellipse?

Some common mistakes include using the wrong parametrization equation, using incorrect values for a and b, or not considering the correct range for the parameters. It is important to double check your equations and calculations to ensure accuracy.

Similar threads

Replies
1
Views
3K
Replies
6
Views
2K
  • Precalculus Mathematics Homework Help
Replies
11
Views
2K
Replies
5
Views
7K
  • Differential Geometry
Replies
8
Views
3K
  • Thermodynamics
Replies
9
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
878
Replies
20
Views
3K
  • Calculus and Beyond Homework Help
Replies
11
Views
2K
Back
Top