Homework due Monday November 27


Last week, I went to the Louvre, something I recommend to everyone who has spare time and 30 dirhams (if under 22 y.o.). During my visit, I saw two pieces that inspired me for this project. Firstly, a sculpture by Alexander Calder, an American sculptor and originator of the mobile, a type of moving sculpture made with suspended shapes that move in response to touch or air currents. Secondly, I saw a painting by Mondrian, a Dutch artist that is considered to be one of the best of the 20th century. 

Here are some pictures of both pieces I took during my visit:



Since both pieces are very simple (at first sight) and share colour scheme, I thought about how would it be like to have a Mondrian that responded to air or touch. Since I don’t have a sensor that I can use to read air currents, I worked with some code to use the mousepad as a way to change the three-dimensional appearance of one of Mondrian’s most famous paintings.


Using the 2D image (Mondrian’s painting) and using some 3D translation techniques that you can read more about here, we get a rectangle for each pixel in three-dimensional space. The z coordinate is determined by the three variables: the position of your mouse (X and Y axis) and the brightness of the color. Brighter colors appear closer and darker ones appear further.

A few extra comments that I did not mention in the actual code so that it did not get messy:

a) The P3D behind the size is what specifies the P3D renderer and you use it for the 3D functionalities.

b) In the line below, you establish the dimensions of each cell. If instead of 2 you type 1, you get very small cells and a very precise and interesting effect. Warning: it is heavy, and the computer takes a while to run it. The bigger the number, less definition but it runs faster. I would go for 2, since it allows you to have a pretty good effect and it does not slow the computer too much.

c) In the line below is where all the action goes on. Depending on whether you would like to change the effect with your mouse’s X position, Y position, or how does the movement react to those, you do all of that here. Feel free to experiment with it!



Leave a Reply

Your email address will not be published. Required fields are marked *