It is also useful to take advantage of the 3D renderer if you want to do the equivalent of "flipping" a shape over the x or y axis, which is easier than trying to recalculate the vertices in your head.
void setup (){ size ( 200 , 200 , P3D ); noStroke (); noLoop (); } void draw (){ fill ( 0 ); capitalE( width / 2 , height / 2 ); fill ( 255 ); pushMatrix (); translate ( width / 2 , height / 2 , 0 ); rotate ( PI ); capitalE( 0 , 0 ); popMatrix (); fill ( 255 , 0 , 0 ); pushMatrix (); translate ( width / 2 , height / 2 , 0 ); rotateY( PI ); capitalE( 0 , 0 ); popMatrix (); } void capitalE( int x, int y) { beginShape (); vertex (x,y); vertex (x,y+ 100 ); vertex (x+ 40 ,y+ 100 ); vertex (x+ 40 ,y+ 90 ); vertex (x+ 10 ,y+ 90 ); vertex (x+ 10 ,y+ 55 ); vertex (x+ 29 ,y+ 55 ); vertex (x+ 29 ,y+ 45 ); vertex (x+ 10 ,y+ 45 ); vertex (x+ 10 ,y+ 10 ); vertex (x+ 33 ,y+ 10 ); vertex (x+ 33 ,y); endShape ( CLOSE ); } |