Skip to content

Instantly share code, notes, and snippets.

@cevherkarakoc
Created July 13, 2016 13:48
Show Gist options
  • Save cevherkarakoc/6cfba6d2b6510300be3b7e56c5762b91 to your computer and use it in GitHub Desktop.
Save cevherkarakoc/6cfba6d2b6510300be3b7e56c5762b91 to your computer and use it in GitHub Desktop.
Converting cartesian coordinates to polar coordinates
function cartesianToPolar(x,y){
return {
radius: Math.sqrt( Math.pow(x, 2) + Math.pow(y, 2) ),
alpha: Math.atan2(y, x)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment