DYVO.XYZ

Mondrian Composition

Piet Mondrian (1872–1944) was a Dutch painter who played a crucial role in the development of abstract art during the early 20th century. He was born in Amersfoort, Netherlands, and began his artistic career as a traditional landscape painter. One of Piet Mondrian's most famous prints is "Composition with Red, Blue, and Yellow" (1930). This iconic work exemplifies Mondrian's distinctive style, characterized by a grid of black lines dividing the canvas into rectangles filled with primary colors and white space.

In this demo, the code generates art similar to "Composition with Red, Blue, and Yellow". The algorithm for generating random rectangles with different sizes follows the Divide-and-conquer algorithm paradigm. The idea is to take a rectangle (initially the entire canvas), randomly decide whether it should be divided horizontally or vertically, and choose a point for division. This process is repeated recursively on the resulting smaller rectangles. To achieve better results, a depth variable is also utilized, which decrements with each level of division. Additionally, there are conditions to prevent cases where the entire canvas is divided only vertically or only horizontally; logic is implemented to disallow a rectangle from being divided in the same direction three times.