%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11585/root/var/www/html/ppaobm/backend/web/assets/16c36a2e/es-modules/mixins/ |
Upload File : |
/** * Calculates the center between a list of points. * * @param {array} points A list of points to calculate the center of. */ var getCenterOfPoints = function getCenterOfPoints(points) { var sum = points.reduce(function (sum, point) { sum.x += point.x; sum.y += point.y; return sum; }, { x: 0, y: 0 }); return { x: sum.x / points.length, y: sum.y / points.length }; }; /** * Calculates the distance between two points based on their x and y * coordinates. * * @param {object} p1 The x and y coordinates of the first point. * @param {object} p2 The x and y coordinates of the second point. * @returns {number} Returns the distance between the points. */ var getDistanceBetweenPoints = function getDistanceBetweenPoints(p1, p2) { return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); }; /** * Calculates the angle between two points. * * TODO: add unit tests. * * @param {object} p1 The first point. * @param {object} p2 The second point. * @returns {number} Returns the angle in radians. */ var getAngleBetweenPoints = function getAngleBetweenPoints(p1, p2) { return Math.atan2(p2.x - p1.x, p2.y - p1.y); }; var geometry = { getAngleBetweenPoints: getAngleBetweenPoints, getCenterOfPoints: getCenterOfPoints, getDistanceBetweenPoints: getDistanceBetweenPoints }; export default geometry;