Question: How to Plot Many Polygons?

I am interested in efficiently plotting a grid of squares where each square is coloured. 

 

From what I understand I can do this using plotting primitives. For example,

P1 := Array( 1..4, 1..2, [[0,0],[1,0],[1,1],[0,1]],storage=rectangular, order=C_order, datatype=float[8] );

P2 := Array( 1..4, 1..2, [[1,1],[2,1],[2,2],[1,2]],storage=rectangular, order=C_order, datatype=float[8] );

PLOT( POLYGONS(P1,P2), COLOUR(RGB,1,0,0,0,1,0)  );

plots one red and one green unit sqaure.

 

I am interested however in plotting millions of squares.  Is there a way to efficiently store the sequence required for the POLYGONS and COLOUR primitive?  Ideally I want to store them as arrays.

Please Wait...