Bitbybit Docs
    Preparing search index...

    Class OCCTVertex

    OpenCascade 中的顶点:内核自身的点形式,即边相接的角。库的其余部分使用普通的 [x, y, z] 点,因此这里的方法主要在两者之间转换:从点创建顶点,从顶点读回点,列出任意形状的顶点,以及将点投影到形状上。

    Index

    Constructors

    from

    • 由 x、y 和 z 值创建顶点。

      Parameters

      Returns Promise<TopoDSVertexPointer>

      顶点

      const vertex = await bitbybit.occt.shapes.vertex.vertexFromXYZ({ x: 1, y: 2, z: 3 });
      
    • 为每个普通的 [x, y, z] 点创建一个顶点,即内核自己的点。

      Parameters

      Returns Promise<TopoDSVertexPointer[]>

      每个点一个顶点,顺序相同

      const vertices = await bitbybit.occt.shapes.vertex.verticesFromPoints({ points: [[0, 0, 0], [1, 0, 0]] });
      
    • 为每个点创建一个顶点,并将它们打包成一个复合体,使整个点云可以作为一个形状绘制或变换。

      Parameters

      Returns Promise<TopoDSCompoundPointer>

      每个点含一个顶点的复合体

      const cloud = await bitbybit.occt.shapes.vertex.verticesCompoundFromPoints({ points: [[0, 0, 0], [1, 0, 0], [0, 1, 0]] });
      

    get

    • 按内核遍历的顺序列出形状的每个顶点。

      顶点会为使用它的每个面和边重复,因此一个长方体列出 48 个顶点而不是 8 个角;要得到不重复的角,请将 getVerticesAsPointspoint.removeAllDuplicateVectors 配合使用。

      Parameters

      Returns Promise<TopoDSVertexPointer[]>

      形状中找到的顶点

      const corners = await bitbybit.occt.shapes.vertex.getVertices({ shape: box });
      
    • 按内核遍历的顺序,以普通的 [x, y, z] 点列出形状的每个顶点。

      顶点会为使用它的每个面和边重复,因此一个长方体列出 48 个点而不是 8 个角;point.removeAllDuplicateVectors 可将它们缩减为不重复的点。

      Parameters

      Returns Promise<Point3[]>

      顶点的点

      const corners = await bitbybit.occt.shapes.vertex.getVerticesAsPoints({ shape: box });
      

    place

    • 沿某方向将点投射到形状上,并给出它们落到的点。

      每个点沿 direction 恰好行进该向量的长度,因此它必须足够长以到达形状。当路径不止一次穿过形状时,projectionType 保留最近的命中、最远的、两者或全部;未命中的路径不给出任何东西。

      Parameters

      Returns Promise<Point3[]>

      投影后的点

      const onGround = await bitbybit.occt.shapes.vertex.projectPoints({
      points: [[0, 10, 0], [1, 10, 0]],
      shape: terrain,
      direction: [0, -20, 0],
      projectionType: Bit.Inputs.OCCT.pointProjectionTypeEnum.closest,
      });

    transform

    • 以普通的 [x, y, z] 点读取每个顶点的坐标。

      Parameters

      Returns Promise<Point3[]>

      每个顶点一个点,顺序相同

      const points = await bitbybit.occt.shapes.vertex.verticesToPoints({ shapes: vertices });
      
    • 以普通的 [x, y, z] 点读取顶点的坐标。

      Parameters

      Returns Promise<Point3>

      const point = await bitbybit.occt.shapes.vertex.vertexToPoint({ shape: vertex });