CPSC 120: Lab Assignment 3

Due at 2:00 pm on Thursday, 02/20/2014

Home | Calendar | Announcements | Assignments | Example Code | Notes

Problem Set

Your solutions to the following problems should be placed in a folder named "lab3". When you have finished the assignment, copy this folder and its contents to your turn-in directory.

Problem One

The Dutch painter Piet Mondrian (1872-1944) was known primarily for his geometric style of painting (which he termed "neoplasticism"). In his paintings, Mondrian reduced his subjects to essentials of form and color, creating compositions of adjoining rectangles, often using only the "artist primaries" of red, yellow, and blue for the painting's color scheme. Other color schemes occur in some of his works, as well, but the geometric character of his works was consistent throughout most of his career.

Some of his works can be seen at these sites:

Your job here is to write a program that produces an image in the neoplasticist style. You should satisfy these constraints:

  1. There should be at least 10 rectangular forms in the image.
  2. Every visible shape in the drawing must be a rectangle. In other words, your drawing must completely fill the window, and no rectangles should overlap. Further, if one rectangle nests inside another one, both rectangles should have the same width or the same height.
  3. The rectangles should all have a strong outline, either black or dark gray.
  4. Some rectangles should be nested in other rectangles, but not all of them.
  5. Your color scheme must consist of exactly four colors, though the distribution of those colors is up to you.

The choice of colors is yours (though pastels would make the De Stijl adherents sad), as is the number and arrangement of rectangular forms.

Save your sketch in the lab3 folder with the name "prob1".

Problem Two

Write a program that produces a sketch consisting of five or more colorful circles on a white background, along the following lines:

Save your sketch in the lab3 folder with the name "prob2".

Turn In

Make a folder in your turn in directory named "lab3". Copy both of your solutions in to this folder. Consult the Linux tutorial from Lab #0 if you need a reminder of the details.


John H. E. Lasseter