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:
  1. Placement of an initial point.
  2. 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.
  3. Creation of a numeric slider.
  4. 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.
  5. Preparation of the spreadsheet.
  6. 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.
  7. The point B1.
  8. 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)
  9. List G1 of distances to the silhouettes.
  10. 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)}
  11. Sorted distance list E1.
  12. Sort the previous list in ascending order: E1= Sort(G1)
  13. Shortest distance C1 and second shortest distance D1.
  14. C1= Element(E1, 1) D1= Element(E1, 2)
  15. Identification F1 of the nearest silhouette.
  16. This last step is only necessary for the scanner in Figure 20. F1= IndexOf(C1, G1)
The scanner is now complete, and all that's left is to animate the slider t to set it in motion. The column of points B1..., B400 will move from left to right across the screen. However, as they pass through, they will only leave a monochrome stain, the same color as B1 (likely black), because we still need to assign dynamic color to each of these points. This dynamic color will depend on the desired result. Once the dynamic color is assigned to B1, we must update the spreadsheet by dragging B1 to B400.
  • 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.
Finally, most of the time, it will be necessary to move the scanner to different heights for different positions of the initial point B0, as the 400 points do not cover the entire height of the painting. Author of the activity: Rafael Losada.