well it depends on the polygon. processing has some built in setups that you can use :
- rect(); ellipse(); quad(); triangle();
if you need custom ones then you want to use the beginShape() and endShape() methods you just need to call vertices between them like so:
- beginShape();
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- endShape();
there are some parameters to how the shape draws that you can call in the begin and endshape methods
To rotate each shape you want to use the translate() and rotate methods() within a push and pop matrix set up like so:
- pushMatrix();
- rotate(45);
- beginShape();
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- vertex(x, y);
- endShape();
- popMatrix();
now collision detection will be complicated depending on your polygons. Rectangles and circles are easy but once you get into complicated shapes I would recommend finding the rectangular or area around the polygon(a circle or rectangle whose circumference or perimeter touches the farthest points of your shape) as a start. Check out this link for a solution for polygon collision detection
http://www.openprocessing.org/visuals/?visualID=6786 its going to be a shit ton of math no matter what.
Hope this helps :)