Skip to content
Advertisement

Calculate the radius of an ellipse using Javascript [closed]

If I have the height and width of an ellipse and the angle from the center. How can I calculate the radius of the ellipse from that angle?

I don’t understand the maths enough to understand how to make this work in Javascript

Advertisement

Answer

See if this works:

let s = Math.sin(angle)
let c = Math.cos(angle)
let r = (a*b)/Math.sqrt(a*a*s*s+b*b*c*c)

where a is the horizontal axis, b is the vertical axis, and angle is the, well, angle.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement