get points away from degree

by cs09g

JavaScript

function radianFromDegree(degree) {
	return degree * Math.PI / 180;
}

function coordFromDegree(fromCoord, bearingDegree) {
	let x = fromCoord[0];
  let y = fromCoord[1];
  let radian = radianFromDegree(bearingDegree);
  let xx = x * Math.cos(radian) - y * Math.sin(radian);
  let yy = y * Math.cos(radian) + x * Math.sin(radian);
  console.log(xx, yy);
}

coordFromDegree([3, 1], 60);