function rotateCoords(coords, ccw, cx, cy) {
  var newCoords = new Array(coords.length);
  for (var i = 0; i < coords.length; i++) {
    var oldX = coords[i][0] - cx;
    var oldY = coords[i][1] - cy;
    var newX, newY;
    if (ccw) {
      newX = -oldY;
      newY = oldX;
    } else {
      newX = oldY;
      newY = -oldX;
    }
    newCoords[i] = [newX + cx, newY + cy];
  }
  return newCoords;
}
// Returns a new list of coordinates, does not modify the original list.
Returns a new list of coordinates, does not modify the original list.
Returns a new list of coordinates does not modify the original list .
function rotateCoords(coords, ccw, cx, cy) {
  var newCoords = new Array(coords.length);
  for (var i = 0; i < coords.length; i++) {
    var oldX = coords[i][0] - cx;
    var oldY = coords[i][1] - cy;
    var newX, newY;
    if (ccw) {
      newX = -oldY;
      newY = oldX;
    } else {
      newX = oldY;
      newY = -oldX;
    }
    newCoords[i] = [newX + cx, newY + cy];
  }
  return newCoords;
}
function rotateCoords ( coords , ccw , cx , cy ) { var newCoords = new Array ( coords . length ) ; for ( var i = 0 ; i < coords . length ; i ++ ) { var oldX = coords [ i ] [ 0 ] - cx ; var oldY = coords [ i ] [ 1 ] - cy ; var newX , newY ; if ( ccw ) { newX = - oldY ; newY = oldX ; } else { newX = oldY ; newY = - oldX ; } newCoords [ i ] = [ newX + cx , newY + cy ] ; } return newCoords ; }
Returns a new list of coordinates, does not modify the original list.
Returns a new list of coordinates does not modify the original list .