2017-10-04 23:58:42 +00:00
|
|
|
var Point = require('../point/Point');
|
|
|
|
|
|
|
|
// Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.
|
|
|
|
|
2016-12-29 00:17:20 +00:00
|
|
|
/**
|
2017-10-04 23:58:42 +00:00
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @function Phaser.Geom.Circle.CircumferencePoint
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on.
|
|
|
|
* @param {number} angle - [description]
|
2017-10-13 13:11:54 +00:00
|
|
|
* @param {Phaser.Geom.Point|object} [out] - [description]
|
|
|
|
*
|
2017-10-04 23:58:42 +00:00
|
|
|
* @return {Phaser.Geom.Point|object} [description]
|
|
|
|
*/
|
2016-12-29 00:17:20 +00:00
|
|
|
var CircumferencePoint = function (circle, angle, out)
|
|
|
|
{
|
2017-10-04 23:58:42 +00:00
|
|
|
if (out === undefined) { out = new Point(); }
|
2016-12-29 00:17:20 +00:00
|
|
|
|
|
|
|
out.x = circle.x + (circle.radius * Math.cos(angle));
|
|
|
|
out.y = circle.y + (circle.radius * Math.sin(angle));
|
|
|
|
|
|
|
|
return out;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = CircumferencePoint;
|