So I am trying to make a program that takes a user input that creates an ellipse. I have coded all the calculations that the input has to go through to develop the eqRad and polRad. I am trying to make these function parameters and I thought this should work (My code is below) but it doesn't. How would I get these parameters to work? Please know that I have a working function above the code snippet I just need to know how to get theses parameters to work. Thank you in advance!
let eqRad = Math.pow((1-Math.pow(e,2)),-1/6);
let polRad = Math.pow((1-Math.pow(e,2)),1/3);
makeEllipse(eqRad,polRad);
}
function makeEllipse(eqRad,polRad) {
let svg = document.getElementById('diagram');
let temp = document.getElementById('mydiagram');
if (temp) {
temp.remove();
}
let ellipse = document.createElementNS('http://www.w3.org/2000/svg', 'path');
ellipse.setAttribute('d', 'M 400 200 a polRad,eqRad 90 1,0 1,0 z');
ellipse.style.fill = 'white';
ellipse.style.stroke = 'black';
ellipse.style.strokeWidth = '5px';
ellipse.setAttribute('id', 'mydiagram');
svg.appendChild(ellipse);