Bitbybit Docs
    Preparing search index...

    Class OCCTAnalysisCurves

    Questions asked of edges and wires, answered with points and numbers rather than new shapes: the closest point with its parameter and length along the curve, curvature and its comb, kinks where the tangent turns, extremes along a direction, and intersections with other curves and with faces. Parameters are fractions from 0 at the start to 1 at the end, where each edge of a wire takes an equal share, as shapes.wire.pointOnWireAtParam takes them. Edges are numbered as shapes.edge.getEdgesAlongWire lists them, and angles are in degrees.

    Index

    Constructors

    curvature

    • Reads how an edge or a wire bends at places given as fractions from 0 at its start to 1 at its end.

      Each result holds the point, tangent, normal, binormal, curvature, radius, center and torsion; a straight stretch reads isStraight with an Infinity radius. At a corner of a wire the edge starting there is read.

      Parameters

      Returns Promise<CurveCurvature[]>

      One curvature per fraction, in the same order

      const [start, middle] = await bitbybit.occt.analysis.curves.curvaturesAtParams({ shape: spline, params: [0, 0.5] });
      const bendRadius = middle.radius;
    • Reads how an edge or a wire bends at places given as lengths along it from its start, in model units.

      Each result is what curvaturesAtParams gives: the point, the tangent, normal and binormal, the curvature with its radius and center, and the torsion. At a corner of a wire the edge starting there is read.

      Parameters

      Returns Promise<CurveCurvature[]>

      One curvature per length, in the same order

      const curvatures = await bitbybit.occt.analysis.curves.curvaturesAtLengths({ shape: spline, lengths: [0, 2.5, 5] });
      const tightest = Math.max(...curvatures.map(result => result.curvature));
    • Draws a curvature comb along an edge or a wire: teeth standing on the curve, as long as the curvature there, pointing away from its center.

      The first polyline runs through the tips, showing how the curvature changes; then comes one two-point polyline per tooth, from the curve to its tip. The teeth are spaced evenly by length.

      Parameters

      Returns Promise<Polyline3[]>

      The polyline through the tips, then one polyline per tooth

      const comb = await bitbybit.occt.analysis.curves.curvatureComb({ shape: spline, samples: 80, scale: 0 });
      const outline = comb[0];

    intersections

    • Finds where two edges or wires cross or touch, with the parameter and the edge of each point on both curves.

      The points come in order along the first curve. Where the curves run together, the two ends of the shared stretch come back marked isOverlap; curves that do not meet give an empty list.

      Parameters

      Returns Promise<CurveIntersection[]>

      The points where they meet, in order along the first curve

      const crossings = await bitbybit.occt.analysis.curves.intersectCurves({ shapeA: path, shapeB: border, tolerance: 1e-7 });
      const pieces = await bitbybit.occt.shapes.wire.splitWireAtParams({ shape: path, params: crossings.map(crossing => crossing.paramA) });
    • Finds where an edge or a wire passes through a face or lies on it, within the face's edges.

      The points come in order along the curve, with u and v as the fractions that shapes.face.pointOnUV takes. A stretch lying on the face gives its two ends, marked isOverlap.

      Parameters

      Returns Promise<CurveFaceIntersection[]>

      The points where the curve meets the face, in order along the curve

      const hits = await bitbybit.occt.analysis.curves.intersectCurveWithFace({ shape: path, face, tolerance: 1e-7 });
      const normals = await Promise.all(hits.map(hit => bitbybit.occt.shapes.face.normalOnUV({ shape: face, paramU: hit.u, paramV: hit.v })));

    points

    • Finds the point of an edge or a wire nearest each given point, with where it lies along the curve.

      Each result carries the point, its parameter as a fraction of the curve, its length from the start, its distance from the given point and the edge it lies on; at a corner that is the edge starting there.

      Parameters

      Returns Promise<CurveClosestPoint[]>

      One closest point per given point, in the same order

      const nearest = await bitbybit.occt.analysis.curves.closestPoints({ shape: wire, points: [[12, 0, 5], [3, 0, -2]] });
      const cut = await bitbybit.occt.shapes.wire.splitWireAtParams({ shape: wire, params: nearest.map(result => result.param) });

    shape

    • Finds the corners of an edge or a wire where the tangent turns by more than an angle, such as the corners of a polyline.

      Each kink comes with the edge ending there and the turn in degrees, in walking order; a closed wire's closing corner, at its start, comes first.

      Parameters

      Returns Promise<CurveKink[]>

      The kinks, in order along the curve

      const corners = await bitbybit.occt.analysis.curves.kinks({ shape: outline, angle: 10 });
      const cornerPoints = corners.map(kink => kink.point);
    • Finds the highest and lowest points of an edge or a wire along a direction, such as the crests of a wave.

      They come in order along the curve, marked as maxima or minima, and as global when nothing lies higher, or lower; ties are all global. An open curve's ends count; a level stretch is reported at its start.

      Parameters

      Returns Promise<CurveExtreme[]>

      The highest and lowest points, in order along the curve

      const extremes = await bitbybit.occt.analysis.curves.extremesAlong({ shape: wave, direction: [0, 1, 0] });
      const crests = extremes.filter(extreme => extreme.isMaximum);
    • Tells what kind of curve an edge runs along: a line, a circle, an ellipse, a hyperbola, a parabola, a Bezier curve, a B-spline, an offset curve or another kind.

      The kinds are the ones select.edges.ofType chooses edges by.

      Parameters

      Returns Promise<curveTypeEnum>

      The kind of curve the edge runs along

      const kind = await bitbybit.occt.analysis.curves.curveType({ shape: edge });
      const isRound = kind === Bit.Inputs.OCCT.curveTypeEnum.circle;