Skip to content

Library API

Matthew Scott edited this page Nov 21, 2026 · 1 revision

Library API

using Quadremesh.Core;
using Quadremesh.IO;

TriangleMesh input = ObjReader.ReadTriangles("input.obj");   // or FbxReader.ReadTriangles("input.fbx")

QuadMesh quads = QuadRemesher.Remesh(input, new QuadRemesherOptions
{
    TargetQuadCount = 5000,                  // or TargetEdgeLength
    Extraction = ExtractionMode.PureQuad,    // default: QuadDominant
    PreserveSharpFeatures = true,            // pin edge loops to creases and boundaries (default)
});

ObjWriter.Write("output.obj", quads);        // or FbxWriter.Write("output.fbx", quads)
Console.WriteLine($"{quads.FaceCount} faces, {quads.QuadFraction:P0} quads");

Faithful QuadriFlow pipeline

FaithfulPipeline is a separate path that follows QuadriFlow stage by stage. Its budget works like QuadriFlow's -f N: it is a target, and the output quad count undershoots it.

QuadMesh faithful = FaithfulPipeline.Remesh(input, targetFaces: 5000);

// Find the coarsest budget that still yields a watertight mesh of the expected genus.
// expectedChi is the Euler characteristic: 2 - 2*genus for a closed surface.
var best = FaithfulPipeline.SearchMinBudget(input, expectedChi: 2, out var scan,
                                            minBudget: 800, maxBudget: 8000, steps: 16);

SearchMinBudget scans rather than bisects, because the watertight test is not monotonic in the budget. Each probe is a full remesh, so treat it as an offline calibration step.

Clone this wiki locally