This is a OpenSCAD example program that creates hinges using adjustable parameters. I think it is a good example of how to translate a common design into OpenSCAD code. In particular the passage where the trig function is used to manage alternating features in a series is worth a look.