Bitbybit Docs
    Preparing search index...

    Class OCCTAnalysisSurfaces

    Questions asked of faces, answered with points and numbers: the closest point with its (u, v), the principal, mean and Gaussian curvature at (u, v) values, and the kind of surface a face lies on. (u, v) values are fractions of the face's UV bounds, from 0 at the start to 1 at the end, the values shapes.face.pointOnUV and the other face samplers take.

    Index

    Constructors

    curvature

    points

    shape

    Constructors

    curvature

    • Reads how a face bends at (u, v) pairs: its largest and smallest curvature with their directions, their mean and product, and the normal.

      U and V are fractions of the face's UV bounds. A curvature is 1 over a radius, positive where the face bulges out along its normal, so the inside of a hole reads negative.

      Parameters

      Returns Promise<FaceCurvature[]>

      One curvature per pair, in the same order

      const [middle] = await bitbybit.occt.analysis.surfaces.curvaturesOnUVs({ shape: face, paramsUV: [[0.5, 0.5]] });
      console.log(middle.maxCurvature, middle.gaussianCurvature);

    points

    • Finds the point of a face nearest each given point, with its (u, v) and the face's normal there.

      The face is bounded, so a point beyond its edges comes to its boundary, which isOnBoundary says. u and v are fractions of the face's UV bounds, as shapes.face.pointOnUV takes them; operations.closestPointsOnShapeFromPoints gives the points alone, for any shape.

      Parameters

      Returns Promise<FaceClosestPoint[]>

      One closest point per given point, in the same order

      const [nearest] = await bitbybit.occt.analysis.surfaces.closestPoints({ shape: face, points: [[3, 4, 15]] });
      const normal = await bitbybit.occt.shapes.face.normalOnUV({ shape: face, paramU: nearest.u, paramV: nearest.v });

    shape

    • Tells what kind of surface a face lies on, such as a plane, a cylinder or a B-spline.

      A surface trimmed to a rectangle reads as the surface it trims, as select.faces.ofType reads it, and a face without a surface, as an imported mesh has, reads as other. A shape that is not a face is refused.

      Parameters

      Returns Promise<surfaceTypeEnum>

      The kind of surface

      const type = await bitbybit.occt.analysis.surfaces.surfaceType({ shape: face });
      const isFlat = type === Bit.Inputs.OCCT.surfaceTypeEnum.plane;