mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 12:43:26 +00:00
Added Ellipse.CircumferencePoint
This commit is contained in:
parent
50ecafe4a5
commit
5f04a659e0
3 changed files with 19 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
var CHECKSUM = {
|
||||
build: 'a2b2b8a0-76fb-11e7-8281-5f266fa7c1f9'
|
||||
build: '5d97e130-7716-11e7-8b1c-25a8a89333fb'
|
||||
};
|
||||
module.exports = CHECKSUM;
|
17
v3/src/geom/ellipse/CircumferencePoint.js
Normal file
17
v3/src/geom/ellipse/CircumferencePoint.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle.
|
||||
*/
|
||||
var CircumferencePoint = function (ellipse, angle, out)
|
||||
{
|
||||
if (out === undefined) { out = { x: 0, y: 0 }; }
|
||||
|
||||
var a = ellipse.width / 2;
|
||||
var b = ellipse.height / 2;
|
||||
|
||||
out.x = ellipse.x + a * Math.cos(angle);
|
||||
out.y = ellipse.y + b * Math.sin(angle);
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
module.exports = CircumferencePoint;
|
|
@ -3,6 +3,7 @@
|
|||
var Ellipse = require('./Ellipse');
|
||||
|
||||
Ellipse.Area = require('./Area');
|
||||
Ellipse.CircumferencePoint = require('./CircumferencePoint');
|
||||
Ellipse.Clone = require('./Clone');
|
||||
Ellipse.Contains = require('./Contains');
|
||||
Ellipse.ContainsPoint = require('./ContainsPoint');
|
||||
|
|
Loading…
Reference in a new issue