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AAM,CAAC,CAAP,GAAW,MAAhB;AAAwB,IAAA,CAAC,EAAE,MAAM,CAAC,CAAP,GAAW;AAAtC,GAAnB;AAEA,SAAO;AACL,IAAA,CAAC,EAAE,IAAI,CAAC,CAAL,GAAS,UAAU,CAAC,CAAX,GAAe,MADtB;AAEL,IAAA,CAAC,EAAE,IAAI,CAAC,CAAL,GAAS,UAAU,CAAC,CAAX,GAAe;AAFtB,GAAP;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":"","file":"math.js"}
|