Slice through torus embedded van der pol attractor animation using POVRAY of 3 cover of torus embedded van der pol attractor. To be discussed in future journal article by Letelliere, Gilmore, and Jones.

A torus is outlined by a quasiperiodic flow on it. This flow is on the ''ima$

-Animation by Timothy Jones

run.pl

#!/usr/bin/perl
for($num=0; $num<=1000; $num+=100){
system("./torus $num");
$number=$num+1000;
$file=$number.".pov";
system("cat temp.pov > $file");
system("cat $num >> $file"); 
system("cat donut.dat >> $file");
system("povray all.ini $file Display=False");}


temp.pov

#include "colors.inc"  
#include "skies.inc"
#include "textures.inc"


// camera-----------------------------------------------------------
#declare Cam1 =camera {location  <-7 , 4 ,-18>
                       look_at   <0.2 , 0.0 , 0.0>
                       angle 40}
camera{Cam1}                                                 //<---1   
// sun -------------------------------------------------------------
light_source{<-1500,2000,-2500> color White*0.7}
light_source{<-100, 100, -200> color White*0.5}




//global_settings {
//   ambient_light
//   rgb <0,0,1>
//}

background {
   color rgb <0,0,0>
}

#macro SP(x0,y0,z0,r0)
    sphere { < x0,y0,z0 >  , r0
               pigment { Gold}//rgb <1,1,1> }
               finish { reflection .5 phong .7 }} 
#end


torus.c

#include < stdlib.h >
#include < math.h >
#include < fstream.h >
#include < iostream.h >
#include < cstdio >

//Adaptation of a Bob Gilmore program
//written in f

int main(int argc, char *argv[]){
  int fiii= atoi(argv[1]);
  float iii=1.0*fiii/10;
  printf("%i \n",fiii);
  int i,nn,m,ord,j;
  nn=95000;
  double pi,r1,r2;
  double phi,alpha,beta,theta;
  double u,v,z,r,x,y,angle,oldang;
  double uu,zz,aa,bb;
  double orig [nn][3];
  double u0,v0,eps1,eps2,rr,renorm [nn][3];
  double delu,delv,rat;

  ///////////////////////////////////PART ONE//////////////

  pi = 3.1415926535;
  alpha = 1.0/12.52;//  !!! 1.0/25.1
  aa = 0.45;   //!!!  0.85
  bb = sqrt(1.0-aa*aa);
  r1 = 1.0;
 
  double X,Y,t;
  double DX,DY;
  double PI=3.14159265;
  double A,b,c,d,w,T,dt;
  int k=1;
  A = 0.25;
  b = 0.7;
  c=1.0;
  d=10.0;
  T=4.0;
  w=2*PI/T;
  int FLAG=0;
  X=0;
  Y=-1;
  dt=0.001;
  t=0;

  FILE * fp;
  fp  = fopen ("donut.dat","w");

  for(i=1; i<=nn;i++){    //    !!!  nn/1000= numbor of wraps in long. 
dir.

   theta = i*(2*pi)/1000.0;    
    phi   = alpha*theta;  //   !!! quasiperiodic ratio
    r2 = 2.0 + r1*cos(phi); //  !!! distinace from origin
    uu  = r2*cos(theta);  //     !!! (uu,v,zz) coordinates
    v   = r2*sin(theta);  //
    zz  = r1*sin(phi);  
    u = aa*uu - bb*zz;  //   !!!   rotation in (uu,zz) plane
    z = bb*uu + aa*zz;  


    DX=b*Y + (c-d*Y*Y)*X;
    DY=-X+A*sin(w*t);
    X += DX * dt;
    Y += DY * dt;
    t += dt;
    if(t>T){t=0;}

    orig[i][1]=  cos(w*t)*(3 + (cos(k*w*t)*X-sin(k*w*t)*Y));//    u; //    
!!!   output coordinate triple
    orig[i][2]=   sin(w*t)*(3+(cos(k*w*t)*X-sin(k*w*t)*Y));//v;
    orig[i][3]= sin(k*w*t)*X+cos(k*w*t)*Y;// z; 
    //  fprintf(fp, "SP(%f, %f, %f, 0.05)\n",u,v,z + 10);}
    fprintf(fp, "SP(%f, %f, %f, 
0.05)\n",orig[i][1],orig[i][2],orig[i][3]+10);}

  fclose(fp);

  /////////////////////////////////////END P.1////////////////

  /////////////////////////////////////Momma loop/////////////
 

  //  u0 =-1.8;    //!!!  coordinates of roation axis
  // v0 = 0.0;


  //for(iii=0; iii<=100; i++){
  // originally iii*0.01 --> 0.0001 so that it goes from 0-10 
effectively
  u0 = -5.0 + (iii*0.01)*(10);
  v0 = 0.0;
  
  //cylinder {<-3,0,7+(clock/1000)*7>,<3,0,7+(clock/1000)*7>,.1 
texture{pigment{color Red} finish {ambient 0.15 diffuse 0.75 reflection 
0.1 phong 1}}}

  /////////////////////////////////////PART 2/////////////////
  eps1=0.001;
  eps2=0.01;

  for(i=1;i<=nn;i++){
    renorm[i][3]=orig[i][3];
    delu = orig[i][1]-u0;
    delv = orig[i][2]-v0;
    rr   = sqrt(delu*delu+delv*delv);

  if(rr>eps2){
      renorm[i][1]=orig[i][1];
      renorm[i][2]=orig[i][2];}

    if(rreps1)&&(rr 1.3)){m=m+1;}
    if((angle > 1.3) && (oldang < -1.3)){m=m-1;}
    oldang = angle;
    angle = angle+m*pi;
    x = pow(r,(1/(1.0*ord)))*cos(angle/ord);
    y = pow(r,(1/(1.0*ord)))*sin(angle/ord);
    fprintf(fp2,"SP(%f, %f, %f, 0.05)\n",x,y,z-5);
    //fprintf(fp2,"%f, %f, %f \n",x,y,z);
    //    write(13,'(3f12.6)')x,y,z
    }

    //For the cylinder
    fprintf(fp2,"cylinder {<%f,0,7>,<%f,0,17>,.1 texture{pigment{color 
Red} finish {ambient 0.15 diffuse 0.75 reflection 0.1 phong 
1}}}\n",u0,u0);
    fclose(fp2);

/// cylinder {<-3,0,7+(clock/1000)*7>,<3,0,7+(clock/1000)*7>,.1 
texture{pigment{color Red} finish {ambient 0.15 diffuse 0.75 reflection 
0.1 phong 1}}}
    /////////////////////////////////////END 3/////
    //     }
}