Bitbybit Docs
    Preparing search index...

    Class CrossSectionOperations

    布尔运算之外处理 Manifold 横截面的方法:通过沿 Z 拉伸或旋转成形将它们变成实体,偏移其轮廓,用凸包包裹它们,简化它们,以及组合和分解它们。每个方法都返回新形状。

    Index

    Constructors

    basic

    • 沿 Z 扫掠横截面,得到给定高度的实体。

      twistDegrees 使顶部相对底部转动,scaleTopXscaleTopY 缩小或放大顶部,nDivisions 在中间添加截面使扭转和锥度保持光滑;两个顶部缩放都为 0 时生成圆锥。center 使实体以 XY 平面为中心而不是立于其上。

      Parameters

      Returns Promise<ManifoldPointer>

      拉伸后的实体

      const twisted = await bitbybit.manifold.crossSection.operations.extrude({ crossSection: square, height: 20, nDivisions: 20, twistDegrees: 90, scaleTopX: 0.5, scaleTopY: 0.5, center: false });
      
    • 使横截面绕 Y 轴旋转成实体,就像车床;只使用轮廓在 X 正侧的部分。

      revolveDegrees 小于 360 时给出部分旋转,circularSegments 设置结果的圆滑程度。内核使结果沿 Z 竖立;matchProfile(默认为 true)将其转回以匹配轮廓。

      Parameters

      Returns Promise<ManifoldPointer>

      旋转成形后的实体

      const vase = await bitbybit.manifold.crossSection.operations.revolve({ crossSection: profile, revolveDegrees: 360, circularSegments: 64, matchProfile: true });
      
    • 将横截面的轮廓向外移动 delta,delta 为负时向内,因此外轮廓扩大而孔缩小。

      joinType 指定角的处理方式:倒圆、削方、斜接或倒角;miterLimit 限制斜接可以伸出多远,circularSegments 设置圆角的圆滑程度。之后用 simplify 清理微小的线段。

      Parameters

      Returns Promise<CrossSectionPointer>

      偏移后的横截面

      const bigger = await bitbybit.manifold.crossSection.operations.offset({ crossSection: outline, delta: 1, joinType: Bit.Inputs.Manifold.manifoldJoinTypeEnum.round, miterLimit: 2, circularSegments: 32 });
      
    • 移除横截面中位于其相邻两点连线 epsilon 以内的点,丢弃近似重复点和共线点。

      更大的 epsilon 移除更多;在 offset 之后运行它以清理偏移遗留的微小线段。

      Parameters

      Returns Promise<CrossSectionPointer>

      简化后的横截面

      const cleaner = await bitbybit.manifold.crossSection.operations.simplify({ crossSection: offsetOutline, epsilon: 1e-4 });
      

    composition