/Origami

computational origami

Primary LanguageJavaScript

Rabbit Ear

Build Status

This is a Javascript library for designing origami.

Check out the documentation it's filled with interactive examples.

Usage

Include rabbit-ear.js

<script src="rabbit-ear.js"></script>

node.js

var RabbitEar = require("rabbit-ear")

API

if you are in the browser, this gives you an SVG rendering of an origami.

var origami = RabbitEar.origami()

that creates an origami object (a piece of paper). it is a FOLD object. put creases into it:

var origami = RabbitEar.origami()
origami.crease([0.5, 0.5], [0.707, 0.707])

fold and unfold to look at the crease pattern:

origami.fold()
origami.unfold()

many of the objects at the top level are math primitives:

RabbitEar.graph
RabbitEar.vector
RabbitEar.matrix
RabbitEar.line
RabbitEar.ray
RabbitEar.segment
RabbitEar.circle
RabbitEar.polygon
RabbitEar.convexPolygon

all of the internal methods are made available. the origami related methods are in core:

RabbitEar.core
RabbitEar.math

There are methods for folding a sheet of paper, checking local flat-foldability, Kawasaki-Justin's theorem, Maekawa's theorem, etc...

this library supports .fold, .oripa, and .svg files. easily convert between them

origami.export.svg()
origami.export.oripa()
// load file
var loaded_image = ...;
RabbitEar.convert(loaded_image).fold()

Developers

compile the source using rollup. In terminal type: rollup -c

License

MIT open source software license