Thursday, November 10, 2011

Drawing a chessboard from a 2x2 unit cell



In my series Drawing a chessboard, a simple way to build the chessboard from a 2x2 unit cell. 



As shown in Fig. 1, a chessboard can be described as a 4x4 array of unit cells composed of 2x2 black and white cells. Thus, this algorithm computes:
  1. the unit cell  
  2. then, duplicate it 15 times to build a stack.
  3. finally, create a montage of 4 rows and 4 columns.
Fig.1: A chessboard is the repetition of a 2x2 unit cell as shown in the top left corner.
Here is the script...

+++ IJ snippet +++
+++ End of IJ snippet +++

Duplicating a great number of the same 2x2 unit cell can be problematic because a lot of windows are created and your OS may have some trouble to manage all these windows. This can be improved by using the Scale operator. Indeed, when detecting a stack, this operation offers the possibility to modify the Z-scale. Thus, our algorithm becomes:
  1. Duplicate once the unit cell and create a 2-slices stack.
  2. Scale this stack by setting the Z-scale to 8 (or Depth to 16). Your 16-slices stack is now created.

+++ IJ snippet +++
+++ End of IJ snippet +++

Hope that helps.

No comments:

Post a Comment