{"version":3,"sources":["../../../../src/components/VSparkline/helpers/math.ts"],"names":[],"mappings":"AAEA,SAAS,GAAT,CAAc,KAAd,EAAoC;AAClC,WAAO,SAAS,KAAT,EAAgB,EAAhB,CAAP;AACD;AAED;;;;;AAKA,OAAM,SAAU,cAAV,CAA0B,EAA1B,EAAqC,EAArC,EAAgD,EAAhD,EAAyD;AAC7D,WAAO,IAAI,GAAG,CAAH,GAAO,GAAG,CAAd,MAAqB,IAAI,IAAI,GAAG,CAAX,CAArB,IAAsC,IAAI,GAAG,CAAH,GAAO,GAAG,CAAd,MAAqB,IAAI,IAAI,GAAG,CAAX,CAAlE;AACD;AAED,OAAM,SAAU,WAAV,CAAuB,EAAvB,EAAkC,EAAlC,EAA2C;AAC/C,WAAO,KAAK,IAAL,CACL,KAAK,GAAL,CAAS,GAAG,CAAH,GAAO,GAAG,CAAnB,EAAsB,CAAtB,IAA2B,KAAK,GAAL,CAAS,GAAG,CAAH,GAAO,GAAG,CAAnB,EAAsB,CAAtB,CADtB,CAAP;AAGD;AAED,OAAM,SAAU,MAAV,CAAkB,EAAlB,EAA6B,IAA7B,EAA0C,MAA1C,EAAwD;AAC5D,QAAM,SAAS,EAAE,GAAG,GAAG,CAAH,GAAO,KAAK,CAAjB,EAAoB,GAAG,GAAG,CAAH,GAAO,KAAK,CAAnC,EAAf;AACA,QAAM,SAAS,KAAK,IAAL,CAAW,OAAO,CAAP,GAAW,OAAO,CAAnB,GAAyB,OAAO,CAAP,GAAW,OAAO,CAArD,CAAf;AACA,QAAM,aAAa,EAAE,GAAG,OAAO,CAAP,GAAW,MAAhB,EAAwB,GAAG,OAAO,CAAP,GAAW,MAAtC,EAAnB;AAEA,WAAO;AACL,WAAG,KAAK,CAAL,GAAS,WAAW,CAAX,GAAe,MADtB;AAEL,WAAG,KAAK,CAAL,GAAS,WAAW,CAAX,GAAe;AAFtB,KAAP;AAID","sourcesContent":["import { Point } from '../VSparkline'\n\nfunction int (value: string | number): number {\n return parseInt(value, 10)\n}\n\n/**\n * https://en.wikipedia.org/wiki/Collinearity\n * x=(x1+x2)/2\n * y=(y1+y2)/2\n */\nexport function checkCollinear (p0: Point, p1: Point, p2: Point): boolean {\n return int(p0.x + p2.x) === int(2 * p1.x) && int(p0.y + p2.y) === int(2 * p1.y)\n}\n\nexport function getDistance (p1: Point, p2: Point): number {\n return Math.sqrt(\n Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)\n )\n}\n\nexport function moveTo (to: Point, from: Point, radius: number) {\n const vector = { x: to.x - from.x, y: to.y - from.y }\n const length = Math.sqrt((vector.x * vector.x) + (vector.y * vector.y))\n const unitVector = { x: vector.x / length, y: vector.y / length }\n\n return {\n x: from.x + unitVector.x * radius,\n y: from.y + unitVector.y * radius\n }\n}\n"],"sourceRoot":""}