phaser/v3/src/geom/circle/CircumferencePoint.js

15 lines
416 B
JavaScript
Raw Normal View History

2016-12-29 00:17:20 +00:00
/**
* Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.
*/
var CircumferencePoint = function (circle, angle, out)
{
if (out === undefined) { out = { x: 0, y: 0 }; }
out.x = circle.x + (circle.radius * Math.cos(angle));
out.y = circle.y + (circle.radius * Math.sin(angle));
return out;
};
module.exports = CircumferencePoint;