UNPKG

spectral-clustering-js

Version:
27 lines (26 loc) 779 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Point = /** @class */ (function () { function Point(coords) { this.coords = coords; } Point.prototype.getX = function () { return this.coords[0]; }; Point.prototype.getY = function () { return this.coords[1]; }; Point.prototype.get = function (i) { return this.coords[i]; }; Point.prototype.euclieanDistanceTo = function (p) { // let's assume both points have the same dimension var sum = 0; for (var i = 0; i < this.coords.length; i++) { sum += (p.get(i) - this.get(i)) * (p.get(i) - this.get(i)); } return Math.sqrt(sum); }; return Point; }()); exports.Point = Point;