fast-mesh-wasm
    Preparing search index...

    Type Alias RepairOp

    RepairOp:
        | { op: "weld"; tolerance: number }
        | {
            areaEpsilon?: number;
            op: "removeDegenerate";
            removeUnusedVertices?: boolean;
        }
        | {
            keepLargest?: boolean;
            minArea?: number;
            minTriangles?: number;
            op: "removeSmallComponents";
        }
        | { op: "orient" }
        | {
            allowUnclean?: boolean;
            dpLimit?: number;
            fair?: boolean;
            loops?: readonly LoopId[];
            maxArea?: number;
            maxDihedral?: number;
            maxEdges?: number;
            maxPerimeter?: number;
            maxRefineVertices?: number;
            op: "fillHoles";
        }
        | {
            center: Readonly<Vec3>;
            falloff: "linear" | "smooth";
            op: "inflate";
            protect?: VertexProtection;
            radius: number;
            strength: number;
        }
        | {
            center: Readonly<Vec3>;
            cycles: number;
            falloff: "linear" | "smooth";
            op: "smooth";
            protect?: VertexProtection;
            radius: number;
            strength: number;
        }
        | {
            center: Readonly<Vec3>;
            maxRounds?: number;
            op: "remesh";
            radius: number;
            splitOnly?: boolean;
            targetLength?: number;
        }
        | { onlyIfMissing?: boolean; op: "captureRestSizes" }
        | {
            center: Readonly<Vec3>;
            limit?: number;
            maxSplits?: number;
            op: "splitStretched";
            radius: number;
            smooth?: boolean;
        }
        | {
            loops: readonly [LoopId, LoopId];
            maxEdges?: number;
            op: "bridgeLoops";
        }
        | {
            center: Readonly<Vec3>;
            direction: Readonly<Vec3>;
            falloff: "linear" | "smooth";
            op: "grab";
            protect?: VertexProtection;
            radius: number;
            strength: number;
        }
        | {
            center: Readonly<Vec3>;
            cycles: number;
            falloff: "linear" | "smooth";
            op: "relax";
            protect?: VertexProtection;
            radius: number;
            strength: number;
        }
        | { distance: number; op: "offset" }
        | { op: "shell"; thickness: number }
        | { op: "simplify"; preserveBoundary?: boolean; targetTriangles: number }
        | { levels?: number; method?: "loop"; op: "subdivide" }

    One repair operation for Scene.repair. Distances and areas are in mesh units (equal to world units). They are converted to f32, so a tolerance or area below the f32 range rounds to 0.

    Type Declaration

    • { op: "weld"; tolerance: number }
    • { areaEpsilon?: number; op: "removeDegenerate"; removeUnusedVertices?: boolean }
    • {
          keepLargest?: boolean;
          minArea?: number;
          minTriangles?: number;
          op: "removeSmallComponents";
      }
    • { op: "orient" }
    • {
          allowUnclean?: boolean;
          dpLimit?: number;
          fair?: boolean;
          loops?: readonly LoopId[];
          maxArea?: number;
          maxDihedral?: number;
          maxEdges?: number;
          maxPerimeter?: number;
          maxRefineVertices?: number;
          op: "fillHoles";
      }
      • OptionalallowUnclean?: boolean
      • OptionaldpLimit?: number
      • Optionalfair?: boolean
      • Optionalloops?: readonly LoopId[]
      • OptionalmaxArea?: number
      • OptionalmaxDihedral?: number

        Reject a minimum-weight triangulation past this dihedral, in radians.

      • OptionalmaxEdges?: number
      • OptionalmaxPerimeter?: number
      • OptionalmaxRefineVertices?: number

        Stop refining a patch once it has this many new vertices.

      • op: "fillHoles"
    • {
          center: Readonly<Vec3>;
          falloff: "linear" | "smooth";
          op: "inflate";
          protect?: VertexProtection;
          radius: number;
          strength: number;
      }
      • center: Readonly<Vec3>

        Brush center in local mesh coordinates, as in views(mesh).positions().

      • falloff: "linear" | "smooth"
      • op: "inflate"
      • Optionalprotect?: VertexProtection

        Vertices this op must hold in place, or move less.

      • radius: number
      • strength: number

        Displacement scale; negative pulls instead of pushing.

    • {
          center: Readonly<Vec3>;
          cycles: number;
          falloff: "linear" | "smooth";
          op: "smooth";
          protect?: VertexProtection;
          radius: number;
          strength: number;
      }
      • center: Readonly<Vec3>

        Brush center in local mesh coordinates, as in views(mesh).positions().

      • cycles: number

        How many Taubin λ/μ cycles to run; 0 moves nothing.

      • falloff: "linear" | "smooth"
      • op: "smooth"
      • Optionalprotect?: VertexProtection

        Vertices this op must hold in place, or move less.

      • radius: number
      • strength: number

        Displacement scale; the per-vertex weight is strength * falloff.

    • {
          center: Readonly<Vec3>;
          maxRounds?: number;
          op: "remesh";
          radius: number;
          splitOnly?: boolean;
          targetLength?: number;
      }
      • center: Readonly<Vec3>

        Region center in local mesh coordinates, as in views(mesh).positions().

      • OptionalmaxRounds?: number

        Maximum split/collapse/flip rounds; unset means the default (10).

      • op: "remesh"
      • radius: number
      • OptionalsplitOnly?: boolean

        Split long edges only (no collapses, no flips); unset means a full pass.

      • OptionaltargetLength?: number

        Target edge length; unset means the mesh-wide mean edge length.

    • { onlyIfMissing?: boolean; op: "captureRestSizes" }
      • OptionalonlyIfMissing?: boolean

        Keep rest sizes the mesh still holds. Unset means false.

      • op: "captureRestSizes"

        Records each vertex's longest edge as its rest size, for splitStretched. Run it before the deformation starts. Not an edit: no undo step, and it must be the only op of its list. Running it again accepts the mesh as it is then as the new rest shape; onlyIfMissing avoids that. The sizes last until a topology edit other than splitStretched, or an undo or redo of an edit from before the capture; undoing a topology edit from after it brings them back.

    • {
          center: Readonly<Vec3>;
          limit?: number;
          maxSplits?: number;
          op: "splitStretched";
          radius: number;
          smooth?: boolean;
      }
      • center: Readonly<Vec3>

        Region center in local mesh coordinates; edges with an endpoint in the region are checked.

      • Optionallimit?: number

        Multiple of the rest size an edge may reach, above 1; unset means 4/3.

      • OptionalmaxSplits?: number

        Most interior splits per call, the longest first; boundary edges do not count. Unset means 2^20.

      • op: "splitStretched"

        Splits the edges a deformation stretched, and nothing else: an edge splits once it is past limit times the smaller rest size of its endpoints, measured by captureRestSizes. Existing vertices keep their ids and positions, nothing collapses or flips, and a triangle with no split edge keeps its slot. Fails while the mesh holds no valid rest sizes: see captureRestSizes.

      • radius: number
      • Optionalsmooth?: boolean

        New interior vertices follow the surface's curvature; false uses midpoints. Unset means true.

    • { loops: readonly [LoopId, LoopId]; maxEdges?: number; op: "bridgeLoops" }
      • loops: readonly [LoopId, LoopId]

        The two loops to connect, from analyze(mesh).loops. Order is insignificant.

      • OptionalmaxEdges?: number

        Maximum vertices per loop; unset means the default (128).

      • op: "bridgeLoops"
    • {
          center: Readonly<Vec3>;
          direction: Readonly<Vec3>;
          falloff: "linear" | "smooth";
          op: "grab";
          protect?: VertexProtection;
          radius: number;
          strength: number;
      }
      • center: Readonly<Vec3>

        Brush center in local mesh coordinates, as in views(mesh).positions().

      • direction: Readonly<Vec3>

        The drag vector in local coordinates; zero moves nothing.

      • falloff: "linear" | "smooth"
      • op: "grab"
      • Optionalprotect?: VertexProtection

        Vertices this op must hold in place, or move less.

      • radius: number
      • strength: number

        Displacement scale; the per-vertex offset is strength * falloff * direction.

    • {
          center: Readonly<Vec3>;
          cycles: number;
          falloff: "linear" | "smooth";
          op: "relax";
          protect?: VertexProtection;
          radius: number;
          strength: number;
      }
      • center: Readonly<Vec3>

        Brush center in local mesh coordinates, as in views(mesh).positions().

      • cycles: number

        How many plain Laplacian passes to run; 0 moves nothing.

      • falloff: "linear" | "smooth"
      • op: "relax"
      • Optionalprotect?: VertexProtection

        Vertices this op must hold in place, or move less.

      • radius: number
      • strength: number

        Displacement scale; the per-vertex weight is strength * falloff.

    • { distance: number; op: "offset" }
      • distance: number

        How far to move the surface along its smooth normals, in mesh units (equal to world units). Positive follows the normals (outward on an outward-wound closed mesh); negative sinks inward. Must be finite; 0 moves nothing.

      • op: "offset"
    • { op: "shell"; thickness: number }
      • op: "shell"
      • thickness: number

        Wall thickness in mesh units (equal to world units): the input surface stays and gains a reversed copy one thickness against its smooth normals, with every boundary rim stitched shut. Must be positive and finite.

    • { op: "simplify"; preserveBoundary?: boolean; targetTriangles: number }
      • op: "simplify"
      • OptionalpreserveBoundary?: boolean

        Keep boundary vertices in place; defaults to true.

      • targetTriangles: number

        Stop once this many triangles are alive; must be at least 1. A target at or above the live count leaves the mesh alone.

    • { levels?: number; method?: "loop"; op: "subdivide" }
      • Optionallevels?: number

        How many times to split every triangle; must be an integer of at least 1. Each level quadruples the triangle count. Defaults to 1.

      • Optionalmethod?: "loop"

        Subdivision scheme; only "loop" exists. Defaults to "loop".

      • op: "subdivide"