Folding Problems

I've been working on this for a month. but essentially this was the problem:



Given a fold line on a sheet of paper, find how the paper would fold. So calculate the vector coordinates for the shape after these two quads are folded.

It took me quite some time to figure this out. I had to go back to high school math, and re-learn all the stuff I slept through. Revised on how to find perpendicular lines, what the slope/gradient of a line is. The constructing triangles using perpendicular line, using triangles soh cah toa properties to calculate the reflected points, etc...

After bunch and bunch of failed attempts I got something like this working. Even after getting this working I had to tweak some stuff because it wouldn't work for all directions and what not.

Then once I had this working for a single fold, I was like cool, let me try for two folds!

And that worked by just incrementally reflecting all the points past a fold and iterating through them... Eventually made it so I can edit foldlines and have multiples.

And then finally, given a printed surface with say some image or graphic on it, how would the graphic look folded up given the fold lines. This one was more tough than I thought and it still break sometimes if the angle of rotation is more than 180 degrees, which I need to figure out how to fix. But still it looks so awesome and feels gratifying!

I find this video the coolest.



Although its funny cause when I print it out and fabricate it... it just feels like... oh cool you printed on a long piece of paper and folded it up :) I shall figure out some use case for this now that I've implemented it :P