npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fold

v0.12.0

Published

FOLD file format for origami models, crease patterns, etc.

Downloads

53

Readme

FOLD [spec, viewer, API]

FOLD (Flexible Origami List Datastructure) is a file format (with extension .fold) for describing origami models: crease patterns, mountain-valley patterns, folded states, etc. Mainly, a FOLD file can store a mesh with vertices, edges, faces, and links between them, with optional 2D or 3D geometry, plus the topological stacking order of faces that overlap geometrically. A mesh can also easily store additional user-defined data. One FOLD file can even store multiple such meshes in "frames" (but this feature is not yet supported in any code).

This repository both documents the FOLD format (which is still in early stages so its definition is evolving) and provides web software tools and JavaScript libraries to aid in manipulation of FOLD files. FOLD is built upon JSON (JavaScript Object Notation) so parsers are available in essentially all programming languages. Once parsed, the format also serves as the typical data structure you'll want to represent foldings in your software. Our libraries also help build useful redundant data structures for navigating the mesh.

FOLD is similar in spirit to the OBJ format (and other similar formats) for storing 3D meshes; its main distinguishing features are easy parsing, easy extensibility, the ability to disambiguate overlapping faces with stacking order, and the ability to define edges and thus edge properties (such as mountain-valley assignments) and arbitrary polyhedral complexes. (Without edges, OBJ cannot distinguish between two faces sharing two consecutive vertices from faces sharing an edge.) In addition, FOLD can support linkages (with 1D edges but no 2D faces).

FOLD Format Documentation

FOLD Software Tools

Here is software supporting the FOLD format, built both within this project and by other people:

  • FOLD viewer loads and display a given .fold file, useful for visualization and testing
  • Amanda Ghassaei's Origami Simulator supports FOLD input and output
  • Tomohiro Tachi's Freeform Origami (simulator and design tool) supports FOLD input and output
  • Robby Kraft's Rabbit Ear is based on FOLD. It includes a file converter (FOLD display, SVG import/export, and flat folding).
  • ORIPA: Origami Pattern Editor v1.10+ supports FOLD import/export (in addition to its OPX file format).
  • Crease Pattern Editor supports FOLD export

FOLD JavaScript Library

For simple web apps, add this tag to your HTML: <script src="https://edemaine.github.io/fold/dist/fold.js"></script> (or save a local copy of dist/fold.js and use that). Then, if you add FOLD = require('fold') to your JavaScript/CoffeeScript code, you can access the library via FOLD.moduleName.functionName, e.g., FOLD.filter.collapseNearbyVertices.

For Node apps, just npm install --save fold; then add FOLD = require('fold') to your JavaScript/CoffeeScript code; then access the library via FOLD.moduleName.functionName, e.g., FOLD.filter.collapseNearbyVertices.

The FOLD library API documents the available modules and functions for manipulating FOLD objects. If you have a .fold file, first parse it with JSON.parse(fileContents) to get a FOLD object.

The JavaScript library also provides a command-line interface called fold-convert. To use it, make sure you have Node.js installed, and then run npm install -g fold from the command line. Then you can use the following features:

  • fold-convert -o .fold *.opx: Convert ORIPA .opx files to .fold.
  • fold-convert --flat-fold -o B.fold A.fold: Flat fold crease pattern A into folded geometry B

Authors

The FOLD format was invented by three people:

We welcome your feedback and suggestions! The goal is for all software in computational origami to support FOLD as a common interchange format.