From 5f04a659e0ca5b9c0771bf7a92b46e046815242c Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 2 Aug 2017 01:12:15 +0100 Subject: [PATCH] Added Ellipse.CircumferencePoint --- v3/src/checksum.js | 2 +- v3/src/geom/ellipse/CircumferencePoint.js | 17 +++++++++++++++++ v3/src/geom/ellipse/index.js | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 v3/src/geom/ellipse/CircumferencePoint.js diff --git a/v3/src/checksum.js b/v3/src/checksum.js index 1ad09d21d..04674cfe8 100644 --- a/v3/src/checksum.js +++ b/v3/src/checksum.js @@ -1,4 +1,4 @@ var CHECKSUM = { -build: 'a2b2b8a0-76fb-11e7-8281-5f266fa7c1f9' +build: '5d97e130-7716-11e7-8b1c-25a8a89333fb' }; module.exports = CHECKSUM; \ No newline at end of file diff --git a/v3/src/geom/ellipse/CircumferencePoint.js b/v3/src/geom/ellipse/CircumferencePoint.js new file mode 100644 index 000000000..fbfe26268 --- /dev/null +++ b/v3/src/geom/ellipse/CircumferencePoint.js @@ -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; diff --git a/v3/src/geom/ellipse/index.js b/v3/src/geom/ellipse/index.js index d0c18c1e9..2e4a8d0b1 100644 --- a/v3/src/geom/ellipse/index.js +++ b/v3/src/geom/ellipse/index.js @@ -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');