Details of the scanner used
This activity belongs to the GeoGebra book Voronoi Paintings.
To apply the scanner, we need to first set the painting we want to scan as the background of the GeoGebra graphics view. On this background, we construct the silhouettes of the focal areas of the positive space.
For the sake of clarity and brevity, let's assume we want to apply the scanner to a painting with only 3 silhouettes, as in Figure 3: p1, p2, and p3. These silhouettes can be polygons, circles, or other types of flat shapes. Since GeoGebra can calculate the distance from a point to a list of objects, we can create different flat shapes by combining different objects into a single list.
To create our scanner, we follow these steps:
- Placement of an initial point. Place an initial point B0 at the desired location on the screen. This point will occupy the top-left position of the rectangular area to be scanned by the scanner.
- Creation of a numeric slider. Create a slider t, from 0 to 10 (this upper value will depend on the width of the painting) with a step of 1/50. We choose this step because in the standard GeoGebra graphics view, each unit occupies 50 pixels. Set the slider's speed to 0.2, which may need to be adjusted based on the result, as it depends on the processor and the number of calculations needed at each step.
- Preparation of the spreadsheet. In the first column, define the auxiliary numbers A1 = 1..., A400 = 400. In the following steps, we will detail how to complete the first row, B1, C1, D1, E1, F1, and G1. By copying (dragging) these definitions to the rest of the matrix, up to G400, we will have completed the scanner.
- The point B1. Points B1..., B400 will sweep the screen, leaving a trace of the color they acquire at each position they pass through. Point B1 is defined as: B1 = B0 + (t, -A1/50)
- List G1 of distances to the silhouettes. Create the list with the distance from B1 to each of the silhouettes p1, p2, and p3: G1 = {Distance(B1, p1), Distance(B1, p2), Distance(B1, p3)}
- Sorted distance list E1. Sort the previous list in ascending order: E1= Sort(G1)
- Shortest distance C1 and second shortest distance D1. C1= Element(E1, 1) D1= Element(E1, 2)
- Identification F1 of the nearest silhouette. This last step is only necessary for the scanner in Figure 20. F1= IndexOf(C1, G1)
- Dynamic color used in Figure 3. For the dynamic color of B1, we use the RGB model with the same expression in all three Red, Green, and Blue channels: 1- exp(-10 abs(C1 - D1)) The resulting color varies from white to black based on the difference in distances C1 - D1, so that as the slider animates, points become black only when they are practically equidistant, thus visualizing the Voronoi diagram.
- Dynamic color used in other Figures except Figure 20. For the dynamic color of B1, we use the RGB model with the following expressions in the Red, Green, and Blue channels, respectively: exp(-abs((C1 - D1) D1/C1)) exp(-abs(C1 - D1)) exp(-abs((C1 - D1) C1/D1)) The resulting color will take dark tones (see Figure 13, left), outlining the silhouettes in blue (C1 close to zero), while the Voronoi diagram will appear in white, as all three color channels will take the value 1 when the difference C1 - D1 is zero.
- Dynamic color used in Figure 20. For the dynamic color of B1, we use the HSL model with the following expressions in the Hue, Saturation, and Lightness channels, respectively: F1/n 1 C1/D1 where n = Length(G1) is the number of silhouettes. The resulting color will outline the silhouettes in black, the Voronoi diagram will appear in white, and each Voronoi region will take a different color based on the value of F1, i.e., based on which silhouette is closest.