构建 Manifold 横截面,即变成实体的平面轮廓:正方形、矩形、圆以及由原始多边形构成的轮廓。它们位于 XY 平面;center 将形状放置在原点上,否则其角点位于原点。
center
由以 2D 点给出的多边形构建横截面,融合重叠的多边形使结果没有交叉。
fillRule 决定多边形重叠处或多边形自相交处哪些区域算作内部。
fillRule
以 2D 点列表表示的多边形和填充规则
横截面
const outline = await bitbybit.manifold.crossSection.shapes.create({ polygons: [[[0, 0], [10, 0], [10, 10], [0, 10]]], fillRule: Bit.Inputs.Manifold.fillRuleEnum.evenOdd }); Copy
const outline = await bitbybit.manifold.crossSection.shapes.create({ polygons: [[[0, 0], [10, 0], [10, 10], [0, 10]]], fillRule: Bit.Inputs.Manifold.fillRuleEnum.evenOdd });
创建给定边长的正方形横截面;center 为 true 时以原点为中心,否则其角位于原点。
边长以及是否居中
正方形横截面
const square = await bitbybit.manifold.crossSection.shapes.square({ size: 10, center: true }); Copy
const square = await bitbybit.manifold.crossSection.shapes.square({ size: 10, center: true });
创建给定半径的圆形横截面,以原点为中心,用 circularSegments 条直边绘制。
circularSegments
半径和边数
圆形横截面
const disc = await bitbybit.manifold.crossSection.shapes.circle({ radius: 5, circularSegments: 64 }); Copy
const disc = await bitbybit.manifold.crossSection.shapes.circle({ radius: 5, circularSegments: 64 });
创建矩形横截面,length 沿 X,height 沿 Y;center 为 true 时以原点为中心,否则其角位于原点。
length
height
长度、高度以及是否居中
矩形横截面
const rectangle = await bitbybit.manifold.crossSection.shapes.rectangle({ length: 20, height: 10, center: true }); Copy
const rectangle = await bitbybit.manifold.crossSection.shapes.rectangle({ length: 20, height: 10, center: true });
Namespace: Bit
Other top-level symbols:
API reference home · Full symbol index · Tutorials and guides · Platform
构建 Manifold 横截面,即变成实体的平面轮廓:正方形、矩形、圆以及由原始多边形构成的轮廓。它们位于 XY 平面;
center将形状放置在原点上,否则其角点位于原点。