Parametrizing an ellipse - what am I doing wrong?

  • Context: Undergrad 
  • Thread starter Thread starter abeall
  • Start date Start date
  • Tags Tags
    Ellipse
Click For Summary

Discussion Overview

The discussion revolves around the parametrization of an ellipse, specifically focusing on how to accurately determine the intersection point of a vector originating from the center of the ellipse and extending outward at a given angle. Participants explore the mathematical formulation and implementation in Flash ActionScript, addressing discrepancies in the results when compared to expected outcomes.

Discussion Character

  • Technical explanation
  • Exploratory
  • Mathematical reasoning

Main Points Raised

  • One participant describes their approach to parametrizing an ellipse using the width, height, and center point, along with an angle derived from a target point, but notes inaccuracies at angles other than 90 degrees.
  • Another participant seeks clarification on the definitions of points p1 and p2, which are later identified as the ellipse center and the target point, respectively.
  • A participant suggests that the angle corresponding to the parameter angleR does not align with the angle from the center to the point on the ellipse, leading to the exploration of alternative equations.
  • A proposed solution involves a new formulation that incorporates a radius calculation based on the ellipse's dimensions, which appears to resolve the initial discrepancies.

Areas of Agreement / Disagreement

Participants express differing views on the relationship between the angle of the vector and the parameter angleR, with some suggesting that they do not have to be parallel. The discussion includes both exploration of the problem and a proposed solution, but no consensus is reached on the initial approach's validity.

Contextual Notes

The discussion highlights potential limitations in the initial parametrization method, particularly regarding the relationship between angles and the geometry of the ellipse. There is an acknowledgment of the need for a more accurate representation of the ellipse's perimeter in relation to the angle used.

abeall
Messages
21
Reaction score
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
what are the p2 and p1?
 
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.
 
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:
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)
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
12K