Question

var x = Cx + a * Math.cos(ang);

var y = Cy + b * Math.sin(ang);

Cx, Cy are cords of center. ang is angle in radians. a is half of width, b is half of height.

If I change values of ang, I get different points on circumference of ellipse. Below is the path, which I get with above equation.

Ellipse

But instead of this elliptical shape, I want something like half ellipse, something like concave mirror. Even if we stretch both of its end to infinity, they should not form elliptical shape.

Concave

Can somebody provide me polar equations for second curve. I am very bad at digital drawing, but you can imagine that as concave mirror.

Était-ce utile?

La solution

The parametric equations for a parabola with focus at (Fx, Fy) and focal parameter 2a, in terms of angle, would be:

x = Fx + (2*a*cos(ang))/(1 + cos(ang))
y = Fy + (2*a*sin(ang))/(1 + cos(ang))

Not too bad. :) You can adjust a as needed. You can actually modify it a bit by adjusting the ratio of the distances from the focus to the plot, versus the plot to the directrix:

x = Fx + (2*a*cos(ang))/(1 + cos(ang))
y = Fy + (2*b*sin(ang))/(1 + cos(ang))

Here the ratio will be b/a. So you can have the same distance from the origin to the vertex (2a) and make b larger to "flatten" the parabola.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top