Added Ellipse.CircumferencePoint

This commit is contained in:
Richard Davey 2017-08-02 01:12:15 +01:00
parent 50ecafe4a5
commit 5f04a659e0
3 changed files with 19 additions and 1 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: 'a2b2b8a0-76fb-11e7-8281-5f266fa7c1f9'
build: '5d97e130-7716-11e7-8b1c-25a8a89333fb'
};
module.exports = CHECKSUM;

View 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;

View file

@ -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');