DriftCapture · function

decimate

mesh simplified until it holds at most budget triangles.

Explained in DriftCapture.

function decimate(mesh: MeshData, budget: number, options?: DecimateOptions): MeshData
import { decimate } from '@driftengine/capture';

Parameters

ParameterTypeDescription
meshMeshData
budgetnumber
options?DecimateOptions

In depth

Answers a mesh rather than filling one, because neither the vertex count nor the triangle count is known before the collapses are made: a caller cannot size the arrays. A mesh already inside its budget is answered as it stands, copied, so a caller never has to ask which it got.