I have a 2D array with 2 types of values : '-1' and non - '-1'. -1 implies pixel off else on. After each loop my array changes.
Hoa can i make a video from these images ? any idea , tools , any help :X

Recommended Answers

All 5 Replies

Can't tell you without seeing the code.

Can't tell you without seeing the code.

Actually, i have a DLA simulation program that moves particles in a 2D grid. So i wanted to make a video of these movements. I have not written the code for visualization. Please give me any suggestion for the visualization of the data .... :(

int main()

{

	int a=0,s_num=0,side_length=10;

	mass_count=new int[N/side_length];  

	

	for(a=0;a<N/side_length;a++)

	    mass_count[a]=0;

		

	printf("\n Enter number of simulations to be done");

	scanf("%d",&s_num);

	for(a=0;a<s_num;a++)

	{

     int i,j,k,l,v,d,direction,p,steps=100,cluster_id=0,c_id=0,px,py,n;

	 map<int,cluster*>::iterator it;

	 particles= new particle[num];

	 cluster_list = new cluster[num];



     //printf("\nEnter number of steps ... ");

     //scanf("%d",&steps);

	 int seed=time(0);// System time is taken as the seed

     srand(seed);//seeding the random number generator

     

     

	 for( i=0;i<num;i++)

	 {

		 clusters[i]=&cluster_list[i];

	 }



     for(i=0;i<N;i++)

     {

        for(j=0;j<N;j++)

            lattice[i][j]=-1;

     }



	 

     

     //Generating atoms randomly



     for(i=0;i<num;i++)

     {

        for(j=0;j< D;j++)

        {

            particles[i].x[j]=int(   (   (double)rand() / ((double)(RAND_MAX)+(double)(1)) )*N);

        }

        

        if( lattice[particles[i].x[0]][particles[i].x[1]] == -1) // if site is unoccupied

        {

            lattice[particles[i].x[0]][particles[i].x[1]] = i;

        }

        else

        {

            i--;

        }



     //printf("%d %d %d \n",i,particles[i].x[0],particles[i].x[1]);

     }

     

     for( i=0;i<num;i++)

     {

          if( particles[i].ID == -1)

          {

              

              identity(i,cluster_id);           

              cluster_id++;

          }

     }

     n_clusters=cluster_id-1;        

     

     ofstream data;


//...
     // a lot of code for simulation
	//.....

	 int steps_taken = j;

	      	 

     data.open("final.txt");

     for(i=0;i<num;i++)

     {

         for( j=0;j<D;j++)

              data<<particles[i].x[j]<<" ";

              

         data<<"\n";

     }

     data.close();



	 cout<<"\n Number of Clusters = "<<n_clusters+1<<"\nSimulation Complete........";

	 cout<<"\n Time taken = "<<time(0)-seed;



     data.open("info.txt");

     data<<N<<" "<<fraction<<" "<<time(0)-seed<<" "<<steps_taken;

	 data.close();

	 

	 

	 /*data.open("N_L.txt");

	 data<<N<<"\n";

	 

     for( i=2;i<N;i*=2)  // assuming that lattice side length = 2^n

     {

		  box b;

          b.setbox_length(i);// boxes of side length 'i'

		  b.setboxes();

		  b.fill_boxes();

          b.box_counting();

                                

          data<<i<<" "<<b.getbox_count()<<"\n";

     }

     data.close();*/

     mass_fractal(side_length);

	 find_length();

//     getch();

     //for(i=num-1;i>=0;i--)

	 //for(i=0;i<num;i++)

     //{

		 delete []particles;

		 //delete (cluster_list+i);

	 //}

   }

   write_length(s_num);

   write_mass_fractal(side_length,s_num);

   delete []mass_count;

   delete []cluster_list;

     return(0);

}

Hi there, I'm trying to do the same thing. Did you get any answers anywhere else?

cheers

Hi there, I'm trying to do the same thing. Did you get any answers anywhere else?

cheers

Not yet... i was on a vacation. But i will definitely do it. Give me some contact info, i'll tell you when its done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.