Jashwant - 6 months ago 48

Javascript Question

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

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

`Cx, Cy`

`ang`

`radians`

`a`

`b`

If I change values of

`ang`

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.

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

Answer

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.