由路径的子路径构建形状:每个子路径一个线框,有多个时打包成复合体,或当 makeFaces 为 true 且轮廓闭合时为面。
joinSegments 在 tolerance 内将连续的线段合并为单条边;scale 和 flipY 将路径的单位和向下的 Y 轴映射到地平面上。空路径给出 undefined。
子路径、是否生成面、连接容差和放置选项
线框、线框复合体或面,路径为空时为 undefined
const shape = await bitbybit.occt.path.shapeFromPath({
subpaths: [{ start: [0, 0], segments: [{ type: "line", to: [10, 0] }, { type: "line", to: [10, 10] }, { type: "line", to: [0, 10] }], closed: true }],
makeFaces: true,
joinSegments: true,
tolerance: 1e-7,
scale: 1,
flipY: true,
origin: [0, 0, 0],
});
通用的 2D 路径构建器:以直线、二次、三次和圆弧段的子路径(即 SVG 路径的词汇)描述轮廓,一次调用即可得到 OpenCascade 线框或面。它本身对 SVG 一无所知;
svg中的 SVG 导入器将文档翻译为这套词汇并调用它。