# Povray and Euler

I found a nice plot by Taha on my Google+ page. It uses a software called MathMod. Euler Math Toolbox can do this too teaming with Povray.

>load povray;
>povstart(zoom=4,distance=6,center=[1,0,0.5],height=45°);
>t=linspace(0,1,100); s=t';
>b=cos(2pi*s)*(t+0.01)+t; c=sin(2pi*s)*(t-0.01); a=t;
>X=cos(2pi*a)*(b+0.1); Y=sin(2pi*a)*(b+0.1); Z=c;
>writeln(povgrid(X,Y,Z,d=0.03,dballs=0,skip=[20,10]));
>povend();


This is all that is needed to generate the following spiraling tube.

Let me explain.

First of all, the pov…() commands generate text snippets which model graphical elements in the syntax of Povray. These text elements are written to a file by writeln(). The commands povstart() and povend() simply open and close the file and start the Povray interpreter. The output of this interpreter is then inserted into the notebook window of EMT.

For an example of such a Povray snippet, let us try the following.

 >povbox([0,0,0],[1,2,3],povlook(green))
box { <0,0,0>, <1,2,3>
texture { pigment { color rgb <0.0627451,0.564706,0.0627451> }  }
finish { ambient 0.2 }
}


This is a green box with side lengths 1,2,3.

The povgrid() command finally is able to draw the surface as a grid. We use the skip= parameter to skip most grid lines from drawing, but still get a smooth appearance of the grid.

The coordinates for the mantle surface of the tube are X,Y,Z. These three variables contain matrices. Thus X[i,j],Y[i,j],Z[i,j] is one point on the surface. To compute these matrices, we use the matrix language of EMT. First, s and t are two vectors, a row and a column vector with values from 0 to 1. Then we generate a cylindrically shaped surface with coordinates a,b,c.

>povstart(zoom=4,distance=6,angle=80°,center=[0,1,0]);
>t=linspace(0,1,100); s=t';
>b=cos(2pi*s)*(t+0.01)+t; c=sin(2pi*s)*(t+0.01); a=t;
>for i=1 to 3; writeAxis(0,1.2,axis=i,c=lightgreen); end;
>writeln(povgrid(a,b,c,d=0.03,dballs=0,skip=[50,50]));
>povend();

This cylindrical surface is then wrapped around the z-axis (point upwards). The details are a bit involved. But any mathematician should be able to understand what is going on here.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.