Challenge 1
Explore how to use Pycairo's translate, rotate, and flip functions for drawing shapes by dividing tasks into parts. Understand canvas transformation by applying flips along x- and y-axes and combining these techniques to simplify shape manipulation.
Task
In this task, we will test our understanding of the translate, rotate, and flip functions. We will be required to draw the following image:
To make it easier, we will divide the task into smaller parts.
Part 1
In part 1, we will draw a shape using multiple rectangles. This will help us test our understanding of the translate and rotate concepts. The sample figure for this is given below:
The properties of the rectangles, shown in the image above, are given in the table below:
Rectangles
Position | Color | Length-Width | Rotation at a point | |
Dark Blue | (100,100) | (0,0,0.5) | (200,200) | 0 |
Light Green | (100,100) | (0,0.5,0.5) | (200,200) | pi/4 |
Purple | (300,300) | (0.5,0,0.5) | (100,100) | 0 |
Gray | (400,400) | (0.5,0.5,0.5) | (100,100) | 0 |
We will write our code in the ...