diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:04:13 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:11:58 -0700 |
commit | d8bd57901e33a7057e26e782e295099ffcc0da89 (patch) | |
tree | e12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/utils/commons.jsx | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/utils/commons.jsx')
-rw-r--r-- | webapp/utils/commons.jsx | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/webapp/utils/commons.jsx b/webapp/utils/commons.jsx deleted file mode 100644 index 224653df7..000000000 --- a/webapp/utils/commons.jsx +++ /dev/null @@ -1,20 +0,0 @@ -export function getDistanceBW2Points(point1, point2, xAttr = 'x', yAttr = 'y') { - return Math.sqrt(Math.pow(point1[xAttr] - point2[xAttr], 2) + Math.pow(point1[yAttr] - point2[yAttr], 2)); -} - -/** - * Funtion to return nearest point of given pivot point. - * It return two points one nearest and other nearest but having both coorditanes smaller than the given point's coordinates. - */ -export function getNearestPoint(pivotPoint, points, xAttr = 'x', yAttr = 'y') { - var nearestPoint = {}; - for (const point of points) { - if (typeof nearestPoint[xAttr] === 'undefined' || typeof nearestPoint[yAttr] === 'undefined') { - nearestPoint = point; - } else if (getDistanceBW2Points(point, pivotPoint, xAttr, yAttr) < getDistanceBW2Points(nearestPoint, pivotPoint, xAttr, yAttr)) { - // Check for bestImage - nearestPoint = point; - } - } - return nearestPoint; -} |