|
@@ -4,7 +4,7 @@
|
4
|
4
|
![main2.png](images/main2.png)
|
5
|
5
|
![main3.png](images/main3-small.png)
|
6
|
6
|
|
7
|
|
-[Verano 2016- Tatiana - Ive]
|
|
7
|
+[Verano 2016- Tatiana - Ive - Tatiana]
|
8
|
8
|
|
9
|
9
|
Recursion is a technique that is commonly used in programming. With this technique, problems are done by solving similar problems but for smaller cases. We can construct sets of objects or tasks using *recursive rules* and *initial values*. *Recursive functions* are functions that are self-invoking, using smaller sets or elements each time, until reaching a point where an initial value is used instead of self-invoking. In this laboratory experience, you will implement some tools to draw and practice the use of recursive functions to fill with color some figures.
|
10
|
10
|
|
|
@@ -48,7 +48,7 @@ The drawing will be on a grid. The tools will be used by clicking any cell in th
|
48
|
48
|
---
|
49
|
49
|
|
50
|
50
|
|
51
|
|
-## `Qt` Coordinates:
|
|
51
|
+## `Qt` Coordinates
|
52
|
52
|
|
53
|
53
|
* The coordinate system in `Qt` works a bit differently, as it is shown in Figure 1. The entries go from left to right, from 0 to the maximum width, and from top to bottom, from 0 to the maximum height.
|
54
|
54
|
|
|
@@ -97,7 +97,7 @@ Although the archive `tools.cpp` is not visible, there is an array called `mColo
|
97
|
97
|
|
98
|
98
|
## Laboratory Session:
|
99
|
99
|
|
100
|
|
-### Exercise 1: Implement the Functions that Operate the Buttons for Drawing Lines
|
|
100
|
+### Exercise 1 - Implement the Functions that Operate the Buttons for Drawing Lines
|
101
|
101
|
|
102
|
102
|
####Instructions
|
103
|
103
|
|
|
@@ -165,7 +165,7 @@ This function should work similarly as the `DiagonalLeft` function but produces
|
165
|
165
|
**Figure 5** - (a) A drawing with a white background and red dots. (b) When the user clicks on the right diagonal line button (`DiagonalRight`) and clicks the cell shown, (c) a right diagonal line that expands towards the top to the right and towards the bottom to the left of the cell clicked is drawn, until it finds a cell with a different color from the color of the background.
|
166
|
166
|
|
167
|
167
|
|
168
|
|
-### Exercise 2: Implement the Functions that Operate the Buttons for Drawing Squares, Triangles and Circles.
|
|
168
|
+### Exercise 2 - Implement the Functions that Operate the Buttons for Drawing Squares, Triangles and Circles.
|
169
|
169
|
|
170
|
170
|
Now, you will implement the functionality to draw squares, circles and triangles. The **size** of the figure drawn will depend on the size selected on sliding bar in the interface.
|
171
|
171
|
|
|
@@ -227,7 +227,7 @@ In this case, only the points that are shown below satisfy the expression $x^2
|
227
|
227
|
|
228
|
228
|
|
229
|
229
|
|
230
|
|
-### Exercise 3: Implement the Function that Fills the Figures using Recursion.
|
|
230
|
+### Exercise 3 - Implement the Function that Fills the Figures using Recursion.
|
231
|
231
|
|
232
|
232
|
In this exercise you will implement the functionality to fill the color of the figures.One of the more convinient ways to express the algorithm to fill the figures is using recursion. A basic recursive algorithm (but it’s pretty weak) is found in Wikipedia:
|
233
|
233
|
|
|
@@ -267,7 +267,7 @@ Use "Deliverable" in Moodle to hand in the archive `tools.cpp` with the functio
|
267
|
267
|
|
268
|
268
|
---
|
269
|
269
|
|
270
|
|
-##References
|
|
270
|
+## References
|
271
|
271
|
|
272
|
272
|
[1] Alyce Brady and Pamela Cutter, http://nifty.stanford.edu/2005/GridPlotter/
|
273
|
273
|
|