Files
NapCatQQ/.pnpm-store/v3/files/50/d3af2f08b0c6bb187810a45581535505dce85b83ab0ef4f1136c99864da0d647b710f3187de8d79f84fbec6f34446918e6f3423d87d59c740c00b95bf4809e
T
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

27 lines
634 B
Plaintext

/**
* @file 按X轴平移变换, 变换中心为图像中心点
* @author mengke01(kekee000@gmail.com)
*/
import {computePath} from './computeBoundingBox';
/**
* path倾斜变换
*
* @param {Object} contour 坐标点
* @param {number} angle 角度
*
* @return {Object} contour 坐标点
*/
export default function pathSkewX(contour, angle) {
angle = angle === undefined ? 0 : angle;
const y = computePath(contour).y;
const tan = Math.tan(angle);
let p;
// x 平移
for (let i = 0, l = contour.length; i < l; i++) {
p = contour[i];
p.x += tan * (p.y - y);
}
return contour;
}