Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getSpline = (points: IPoint[]) => {
const data: number[] = [];
if (points.length < 2) {
console.warn(`point length must largn than 2, now it's ${points.length}`);
}
for (const point of points) {
const { x, y } = point;
data.push(x);
data.push(y);
}
const spliePath = catmullRom2Bezier(data);
spliePath.unshift(['M', points[0].x, points[0].y]);
return spliePath;
};
getLinePath() {
const crp = this.get('crp');
const axisStart = this.get('axisStart');
const path = pathUtil.catmullRom2Bezier(crp);
path.unshift([ 'M', axisStart.x, axisStart.y ]);
return path;
}