Last week, I worked on integrating code from the circle packing software, CirclePack, into our library, generating random convex hulls of circles on the sphere, and projecting points, lines, circles, and arcs from the sphere onto a 2D plane. This week was all about taking these advances from last week and finally starting to incorporate the soap bubble part of the project into our work. Pretty exciting!

We started by projecting our Voronoi Diagrams from the sphere onto a 2D plane, which we were able to do using our stereographic projections of points and circular arcs from the sphere (PointS2 and CircularArcS2) into 2D (PointOP2 and CircularArcOP2) and looping over the edges and vertices of our Voronoi Diagram. Then, the idea was to use our LineOP2 class to intersect our Voronoi Diagram at evenly spaced divisions, to simulate light rays hitting a soap bubble cluster in order to create a 2D scan of the image. This involved adding code to our library to compute the intersection points of LineOP2s with DiskOP2s and CircularArcOP2s, as well as code to draw LineOP2s and the intersection points we obtained.

The next step was figuring out how to save a ‘ground truth’ image of the Voronoi Diagram which had been generated, which I implemented in two separate functions. First, I created a function that would take in the Voronoi Diagram (a list of CircleArcOP2s), a specified angle for the light beams, and the desired number of divisions, and would generate the specified number of lines (beams), then compute all of intersection points between these lines and the diagram, and add them all to an array holding PointOP2s. Then, I created a second function which would actually render the image by taking in the list of intersection points and creating an image where pixels were colored white where that location did not contain a point of intersection, while pixels were colored black if that location did contain a point of intersection. The function then saved this resulting image as the ground truth image of the diagram/bubble cluster.

Finally, the last step was actually creating the function that would imitate a scan from a given angle, by returning a 1D image represented by an array holding the number of intersection points a given line had with the arcs of the Voronoi Diagram. Then, I also created an additional function which took this size-n 1D array, created an n x n 2D array that was scaled with valid pixel values between 0 and 255, and then generated a grayscale banded image in which darker bands showed more intersections while lighter bands showed less. Here are a couple of pictures that hopefully illustrate the idea a little more clearly:

###### Fig. 1: Simulation of a 2D scan of a soap Fig. 2: Ground truth image of the soap Fig. 3: 1D Image representing bubble cluster with light beams shot at bubble cluster created by finding and plotting a scan from a given angle. an angle of 0 radians, represented by the intersection points of the light beams. Darker bands indicate more LineOP2s. and the arcs of the VD (generated with many intersections in this area. more subdivisions than shown in Fig. 1)

I then created a script to generate a couple of these banded images at different angles, with hopes to overlay the images and obtain a master image that looked somewhat like our Voronoi diagram. However, we realized something along the lines of ten images was definitely nowhere close to enough to generate a meaningful image, and that it would be tiring to overlay any more than ten by hand.

So, what I am currently working on is creating a script that generates 180 different images by rotating the image by and angle of Pi/180 each iteration, so that we have images for angles ranging from 0 to Pi (starting at Pi, we obtain no new information since the images are just flipped versions of the images produced in the first 180 iterations). This should be much more sufficient for creating our master image, as it will incorporate much more information then, say, ten images. Finally, I will be figuring out how to overlay these 180 images (not by hand!) and scaling the result to hopefully produce a simulated image which matches our ground truth image of our initial Voronoi Diagram/ soap bubble cluster. Almost there!