Skip to content

Instantly share code, notes, and snippets.

@ruthenium
ruthenium / cartesianToPolar.js
Created February 24, 2017 17:19 — forked from cevherkarakoc/cartesianToPolar.js
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)
}
}
@ruthenium
ruthenium / polarToCartesian.js
Created February 24, 2017 17:19 — forked from Raisi/polarToCartesian.js
Transform Polar to Cartsian Coordinats
/**
* Coordinates Transformations
*
* http://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle
*
* @param centerX
* @param centerY
* @param radius
* @param angleInDegrees
* @returns {string}