• Parameters

    • file: string | FOLD

      a FOLD object or a string encoding of a FOLD file

    Returns string

    an OBJ representation of the FOLD object

    Description

    Convert a FOLD object into an OBJ file. For FOLD objects with many frames, this will only work on one frame at a time.

    Example

    // from FOLD file
    const foldfile = fs.readFileSync("./crane.fold", "utf-8");
    const objFile = foldToObj(foldFile);
    fs.writeFileSync("./crane.obj", objFile);

    Example

    // from FOLD object
    const birdBase = ear.graph.bird();
    const objFile = foldToObj(birdBase);
    fs.writeFileSync("./bird-base.obj", objFile);

    Example

    // with triangulated faces
    const { result } = ear.graph.triangulate(fold);
    const objFile = foldToObj(result);