Foldinator 2 Build 2

Development of Foldinator2 continues. You can see the second prototype here:

Meanwhile the first prototype is archived here:

It still doesn’t fold paper, but it’s starting to do some interesting things. You can click on the “Load” button and see a list of models, encoded as OrigamiXML files. Select one and open it. You can see the UI update display the model name and author, and the text annotation for the first step. You can use the shuttle controls in the lower right to move forward and backward thru the steps, and jump to the beginning or end of the model.

A bunch of stuff is going on behind the scenes in support of this. I’ve implemented a file loader for the xml file that contains the list of models and their file names, as well as for the models themselves. I’ve create a hierarchy of classes to represent the data. The first of these is OrigamiModel, which contains metadata about the model, such as the title and author, and holds references to two other objects, OrigamiPaper and an ArrayCollection of steps. OrigamiPaper has properties for the papers proportions, color and starting orientation. The steps are of type OrigamiStep. This class contains properties for the steps action, annotation, and an ArrayCollection of creases. OrigamiCrease encapsulates the data to represent a crease, including properties such as the end coordinates, angle, parity swing, layers, etc. These last two classes will likely develop more properties and functionality as I build the folding engine.

I need to do a bit of bulletproofing around the initialization, and then it’s on to the main event, namely drawing and animating the folding paper. To begin with I’ll just be drawing a square procedurally and in accordance with the initial state specified in origamiPaper. Then I’ll be analyzing the geometry of the crease in the first step and breaking the square into appropriate polygons with a common edge, and rendering that. At first I’m going to concentrate on non-folding operations, namely Flip and Rotate the paper. Then it’s on to simple folds: Valley Fold, Mountain Fold, and Fold/Unfold. It’ll be a fair amount of work to get this far. Hopefully I’ll be able to apply this recursively for the second and subsequent steps, but more than likely there’ll be some gotcha.

Leave a Reply