Particle tracking using IDL
Home | Download software | Tutorial | Extra software

mkpov.pro

This routine helps you make 3D pictures from your data, using the public domain 3D rendering routine POV-Ray. See also:

  1. Introduction/IDL routines (you are here)
  2. Stepping through a POV-Ray file
  3. Running POV-Ray on a Linux computer
  4. Running POV-Ray on a Windows computer

POV-Ray is a standalone program that runs on a variety of operating systems. The mkpov routine generates a text file that is interpreted by POV-Ray to produce a picture. mkpov has a variety of options to help you make a nice picture. POV-Ray is a powerful program and can make beautiful and realistic pictures. Having it simply draw spheres is vast overkill, but it works. Furthermore, it makes it easy to change the color & size of each sphere individually.

Basic syntax:
IDL> pts=fltarr(3,1000)
IDL> t=findgen(1000)/1000*3.14159*2*30
IDL> pts(0,*)=10*cos(t/3)
IDL> pts(1,*)=10*sin(t/5)
IDL> pts(2,*)=10*sin(t/2)
IDL> mkpov,pts,'img01.pov'
center of data at:      11.0000      11.0000      30.0000
camera at:              11.0000      11.0000      64.0000
IDL> $x-povray +Iimg01.pov +D 2>err

The mkpov command creates the file "img01.pov". The last command calls the linux routine x-povray which generates the picture. This is a three-dimensional Lissajous figure. Larger values of x are at the left of the picture. Larger values of y are at the top of the picture. Larger values of z are closer to you.


mkpov keywords: (Brief listing here, see examples below)


More examples:

Using color:

Starting with the array pts defined in the first example:
IDL> col=fltarr(3,1000)
IDL> col(0,*)=findgen(1000)/1000*0.6+0.2
IDL> col(1,*)=col(0,*)
IDL> col(2,*)=col(0,*)
IDL> mkpov,pts,'img02.pov',color=col,/nobox
IDL> $x-povray +Iimg02.pov +D 2>err

Here I've made an array col which is in one-to-one correspondence with the data array (pts). I've filled it with greyscale values between 0 and 1, or in this case, actually between 0.2 and 0.8. Also, I've used the /nobox keyword to turn off the bounding box.

To be more colorful:
IDL> col=bw2rgb(t)
IDL> mkpov,pts,'img03.pov',color=col,/nobox
IDL> $x-povray +Iimg03.pov +D 2>err

Now I'm using the program bw2rgb which converts an array of greyscale values into red/green/blue values. (Here, my greyscale array is the original t array defined in the first example at the top of this page.)

Different coloring:
IDL> col=bw2rgb2(t)
IDL> mkpov,pts,'img04.pov',color=col,/nobox
IDL> $x-povray +Iimg04.pov +D 2>err

bw2rgb2 has slightly more intense colors.

Different coloring:
IDL> col=bw2hotcold(t)
IDL> mkpov,pts,'img05.pov',color=col,/nobox
IDL> $x-povray +Iimg05.pov +D 2>err

bw2hotcold maps 0 to blue, 1 to red.

Changing particle size:

IDL> rad=(sin(t/6)+1.5)*0.4
IDL> mkpov,pts,'img06.pov',radius=rad,/nobox
IDL> $x-povray +Iimg06.pov +D 2>err

Here I've defined the array rad which specifies the radius of each particle. The units for radius are the same as the input data.

Changing camera angle:

IDL> col=bw2rgb2(t)
IDL> mkpov,pts,'img07.pov',color=col,/nobox,camera=[34,11,54]
IDL> $x-povray +Iimg07.pov +D 2>err

I've moved the camera to a larger x value and slightly smaller z value. This is sort of like rotating the image to the right. See also the next example.

Changing the box margin:

IDL> mkpov,pts,'img08.pov',color=col,camera=[34,11,70],margin=2
IDL> $x-povray +Iimg08.pov +D 2>err

I've moved the camera again, further away and closer to the original angle; and also added a margin of 2 units to the box size.

Slightly different camera angle:

IDL> mkpov,pts,'img09.pov',color=col,camera=[11,34,70],margin=2
IDL> $x-povray +Iimg09.pov +D 2>err

I've moved the camera again.


Extras


Contact us