Pages

Wednesday, February 28, 2018

Replicating XYZT art

Artechouse: XYZT: Abstract Landscapes.



frames=dir('*.png'); first(1,:,:,:)=imread(frames(1).name); im=repmat(first,130+2,1); % initialize buffer for i=1:length(frames) im=circshift(im,1); im(1,:,:,:)=imread(d(i).name); for j=1:size(im,2) % build image from interpolated rows in buffer k=130*j/size(im,2); fk=floor(k); o(j,:,:)=double((1-(k-fk))*im(fk+1,j,:,:))+double((k-fk)*im(fk+2,j,:,:)); end imwrite(uint8(o),sprintf('%06d.jpg',i)) end

Monday, February 19, 2018

Optimal circle packing

The highest-density lattice arrangement of circles is the hexagonal (honeycomb) packing arrangement, with the density shown below. There are many ways to arrive at this result. Some more or less rigorous. Glancing over a few solutions, I decided to try it for myself. I am not a mathematician and my solution is certainly less than rigorous, but I just put it out there since it could have some pedagogical value. \[Density=\frac{\pi\sqrt{3}}{6} \approx 0.907\] Fill up a unit square with a (large) number of circles packed inefficiently on top of each other. Now tilt this square to pack the circles more efficiently:


Now the sides are still unit length, but the height has changed, and this change in height is a measure of the improvement in packing efficiency. We can view the new shape as two equilateral triangles, and by Pythagoras we then have: \[height^2 + (\frac{1}{2})^2 = 1^2\implies height = \frac{\sqrt{3}}{2}\] So this is the relative improvement over the inefficient packing, but we want to know the actual density: The density of a circle within a square is π/4, and by the nature of this inefficient 'modular' block design, this is also true when we scale up to a larger number of circles. So for the inefficient design we generally have: \[Density=\frac{\pi}{4} \approx 0.785\] So in order to get the overall density of the more efficient packing scheme, we just need to adjust π/4 with the relative improvement in the more efficient packing scheme √3/2: \[Density=\frac{\frac{\pi}{4}}{\frac{\sqrt{3}}{2}} = \frac{\pi}{2\sqrt{3}} \approx 0.907\] Note: In case you are comparing this to other texts, the formula can be rewritten in a couple of ways: \[Density= \frac{\pi}{2\sqrt{3}}=\frac{\pi\sqrt{3}}{6}=\frac{\pi}{\sqrt{12}} \approx 0.907\]

Edit, 03/02/2022. Why? You may ask. Why not? But in any case this kind of math may be descriptive for some evolutionary stuff. Cells and what not. https://datagenetics.com/blog/june32014/index.html