Skip to content

Development

Thomas Waters edited this page Jul 3, 2023 · 1 revision

Development

The origami editor is built around the Elmish Model-View-Update architecture and the Avalonia.FuncUI package.

Fold Package

The main input type is the FOLD file type developed by Erick Demaine for use of encoding origami related data. This is how this program stores information on the hard drive. The part of the fold format specification that we are using focuses around storing information about crease patterns. The main types of information that you need to store a crease pattern are

  • Edges represent the creases or folds in the paper
  • Vertices are the points on the paper where two creases intersect
  • Faces are the polygons, usually triangles or squares that are created from creases and the edges of the paper

The fold specification provides a common serialization and deserialization format which has become the standard mode of encoding of origami documents. This is great for serialization and deserialization, but since the specification of the fold format is so broad, it makes it cumbersome to use as is within this program. The manipulation of the program is instead handled by it's own origami format.

Origami Crease Patterns

This data structure uses the same basic data information as above and is all contained in the same data structure called the Graph

  • Graph
    • Edges
    • Vertices
    • Faces

This origami editor tries to provide an easy way to create a crease pattern. Luckily origami often follows predictable folding patterns when folding by reference. These basic folding patterns broken down to a nitty gritty level come to us in the form of the Origami Axioms. Using these axioms, we can help the user work out where they want to fold by having them select the reference points and creases that are used in the operation. From these references in the graph, we can look through the axioms to determine where we can fold the paper using those operations.

The main workflow is then as follows

  1. Select all your reference elements (vertices and edges)
  2. Program shows you possible folds created from those elements
  3. Select the new crease to put into the fold diagram
  • Clip the line down or select only partial segment

Graph Structure

Origami crease patterns are built around a graph structure representing the edges created by creasing the paper, the vertices created when two creases intersect each other, and the face which is the polygon space between all the creases.

  • Vertex: Point2D
  • Edge:
    Start: Point2D
    End: Point2D
    Crease: CreaseType
    
  • Face: Polygon2D

Reference Finder

The reference finder is a tool that help create a fold sequence to create a point anywhere on a square sheet of paper. For example, if you are looking for a fold that is 1/4th of the way down the page and 1/3 of the way across, you could enter x=0.25, y=0.33 and the reference finder tool will give you several approximations

image

The program also provides you with each of the steps that are required to perform the fold sequence. Each of the solutions that are given may contain different numbers of folds and error rates. This is a trade off that is left to the pattern designer to choose from as each solution may have tradeoff of complexity or commonality with their existing design.

Implementation

The reference finder works by pre-calculating a lookup table of all possible crease patterns. This lookup table is created by starting with a blank square sheet of paper and running through all the origami axioms performing all the possible fold variations and storing them for later. Once this tree is calculated to a particular depth of it's maximum number of folds, the lookup table is ready to query.

This is where the user is able to provide the position of the point that they would like to recreate. We then search through all the results looking to see if any of the crease patterns have a point that is close to the input point. If the point is under a small percent error like 5% away from the desired point, we'll consider this a possible solution. We then rank all those solutions and provide them to the user.

Each solution contains several bits of information that help provide the user with a helpful step by step process of how to get to their desired solution.

The process in a more summarized for is as follows

  1. Initialization
    1. Create a blank page
    2. Perform all folds of depth 1
    3. On each of the children run all the axioms again
      • Repeat until the desired depth is reached
  2. Querying
    1. Search through the tree analyzing each of the crease patterns created
    2. Find the closest point in the crease pattern to the desired position
    3. Cull any results under the desired error margin
    4. Sort the results by the most helpful (small error and least number of folds)
  3. Display
    1. Show the final crease pattern with the person's solution
    2. Provide the user with the opportunity to view other solutions
    3. For each solution, allow the user to walk through each of the fold steps
Clone this wiki locally