Algorithmic design of origami mechanisms and tessellations