This little accident happened while I was developing a MATLAB script for my dissertation. The script was intended to model the positions of abrasive filaments based on an experimentally measured 2D pointset.
In particular, I examined the histogram of distances between neighboring filaments. To achieve this, I computed the Delaunay triangulation of the pointset, a common algorithm used in numerical simulations to create triangular meshes between nodes. My algorithm took a uniformly distributed pointset as input and iteratively adjusted the points to match the distance histogram of the experimental pointset, the result of which you can see in the graph below.
Further below, you can also see the intended outcome. Never mind its unattractive visual appearance; it was designed solely to assist me during development and was never intended for public release. The blue dots represent the experimental pointset, while the red and green dots represent the modeled pointset, their difference being that the green dots lay outside the boundaries I specified (they were necessary for the algorithm to perform correctly at the margins). Does not look very meaningful, right? At least not as meaningful as the histograms.
However, while I was messing around with the code and tried various approaches, I accidentally commented out a line intended to normalize the histogram so that the sum of all its bins equaled one (or 100 %). This was what I had tuned my other parameters to. Upon observing the visual representation, I was greeted with the image below. The forgotten normalization had over-amplified the modeled pointset, resulting in a circular explosion. The box in the center shows the intended size.
Naturally, I preserved a copy of the faulty code, viewing it as a form of art. Moreover, I could adjust some parameters to influence the result, though I will not delve into the specifics here due to my own limited understanding. Forgotten normalization of histograms has probably brought down a satellite or two.
To better visualize the phenomenon, I created animated GIFs illustrating how the dots were gradually arranged by the algorithm, accumulating in random areas, and forming windings resembling a brain. To avoid cluttering your browser cache, I have only included one representative example on this page, which also happened to be the last GIF I generated.
Leave a Reply