Monday, September 24, 2007

Slice of Menger sponge


Slice of Menger
Originally uploaded by Seb Przd
What happens when you slice a Menger Sponge diagonally through the center? well, a very interesting pattern of stars and hexagons. This is the level four iteration on the Menger sponge.

I haven't seen this mentioned before on the internet. Maybe a reader will know if these intersections of the Menger Sponge have been studied before? Wolfram mentions that:
The Menger sponge, in addition to being a fractal, is also a super-object for all compact one-dimensional objects, i.e., the topological equivalent of all one-dimensional objects can be found in a Menger sponge (Peitgen et al. 1992).

Sunday, September 09, 2007

Zenith bug in Enblend 3.0, some progress

Ever since version 3.0 of enblend was introduced, there has been an annoying bug with the way the zenith is blended (and also, it seems on some vertical lines). Development of enblend is not very transparent, and it is not very clear whether this bug has been acknowledged by the developer. So here is my attempt to explain a bit more what is happening and give the repeatable conditions under which the bug is apparent.

The source files, as produced by hugin, are here. They are numbered from 0 to 9, 0 is the nadir (the floor), 1 is the zenith (the sky) and 2 to 9 are the horizon images.

Here is an example of what the bug looks like: a nasty grey line in the top of the image.

This can be corrected by loading on top of this image the tif file of the zenith, and replacing the top part of the image. But it is a pain in the mouse to do this every time.

What I've found is that the order of loading the images is important for this bug to appear. I used to blend in order 2 to 9, 0 and 1, since this stitches first the horizon row of images. But if the zenith is the first image loaded (so the images are stitched 1 to 9 and 0) the resulting image looks like this:

i.e., a trouble free image. I tried other permutations of the images, and if the zenith is "blended" unto another image the bug appears (e.g., if the images are blended 2, 1, 3 to 9 and 0). However if 0 and 1 are loaded first, since they do not overlap they are not blended, and the bug in the zenith does not appear.

Thursday, September 06, 2007

Multiplane Perspective in MathMap

Four rectilinear projections with carefully selected field-of-views to produce a 360° panorama without corners (almost). You have to view the original panorama to compare.


There are other "multiplane perspective" panoramas, loosely inspired by this paper.
Here is the script to be used in MathMap.

How to use this script

  1. Load a suitable equirectangular image in Gimp (with four walls in a rectangle - this script does not cover trapezoidal rooms)
  2. Open the MathMap plug-in
  3. Copy & paste the code that you will find below
  4. Select "Wrap" in the settings
  5. In the User values, change lambda0 until a corner of the room in your panorama is at the border of the image.
  6. Still in the User values, change t3 until the leftmost wall is exactly covered by
    the first rectilinear projection
  7. Change t2 until the second leftmost wall is covered exactly by the second rectilinear
    projection
  8. Finally, change t3 until the last corner of the room is split between the last two
    rectilinear projections
  9. Change size (the vertical field of view) and yshift until the image looks fine
  10. Press OK, wait, and save.

#####################################################
# Four rectilinear projections covering 360° #
# Mathmap script by Seb Przd (2007) #
# http://flickr.com/photos/sbprzd #
# Licensed under the GPLv3 #
#####################################################
filter fourrectilinear (image in,float size: 1-2 (1),
float lambda0:-1-1 (0),float yshift:-1-1(0),float t3:
0-1(0.5),float t2:0-1(0.5),float t1:0-1(0.5))
il=0.01;ir=0.99;epsl=-100;epsr=100;iter=0;eps=1;while
(abs(eps)>0.0001)&&(iter<20) do xu=(il+ir)/2;tt1=tan(
pi/2-t1*pi)/2; tt3=tan(pi/2-t3*pi);yu=tt1+sqrt(xu*(1-
xu)+tt1^2); llmyy=tt3+sqrt(xu*(1-xu)+tt3^2);ll=llmyy+
yu;eps=tan(pi/2-t2*pi)-(-yu*llmyy+(1-xu)^2)/(ll*(1-xu
));if eps*epsl<0 then ir=xu;epsr=eps;else il=xu;epsl=
eps;end;iter=iter+1;end;l2=(1-xu)/(1+ll);l4=xu/(1+ll)
;l1=llmyy/(1+ll);l3=yu/(1+ll);xmvec=[-1,-1+l2+l4,0,l2
+l4,1]; xcvec=[-1+l4,-l3,l2,1-l1];lvec=[l1,l2,l3,l4];
lpv=[-3,-1,1,3]*pi/4+atan(l4,l1);xx=x*size;yy=y*size;
co=0; while co<=3 do xc=xcvec[co];xt=xx-xc*X;yt=yy-X*
yshift;if xx<=xmvec[co+1]*X&&xx>= xmvec[co]*X then lp
=lpv[co]; x0=xt;y0=yt;lc=lvec[co];end;co=co+1;end;rr=
sqrt(x0^2+y0^2);c=atan(rr/Y/2/lc);phi=asin(y0*sin(c)/
rr);in(xy:[atan(x0*tan(c),rr)*X/pi+lp*X/pi+lambda0*X,
phi*Y/(pi/2)]) end