POV-Ray : Newsgroups : povray.newusers : POC crashes using spline : POC crashes using spline Server Time
7 Jul 2024 07:32:44 EDT (-0400)
  POC crashes using spline  
From: geogeo
Date: 10 Jan 2010 15:05:01
Message: <web.4b4a31f4b364303c7a10edb40@news.povray.org>
I've been battling with this for some hours now so thought it time to cry Help!
Trying to place objects along a helix using a spline, code as below. When I
activate the the commented out bit (last section of code) POV crashes every
time. Any ideas anyone?
Thanks, Geo

// generate helix -----------------------------------------
#declare R1=3.5;     //outer radius
#declare F1=0.2;     //point spacing
#declare N=100;      //points on helix   200
#declare H=20;       //tightness

//set up helical spline -------------------------------------------
#declare P2 = array[N][3];
#declare j=0;
#while (j<N)
 #declare P2[j][0] = (j*H/N)-(H/2);
 #declare P2[j][1] = R1*sin(F1*j);
 #declare P2[j][2] = R1*cos(F1*j);
 #declare j=j+1;
#end

#declare j=0;
#while (j<N)
  #declare helix_spline1 =
  spline { natural_spline
  j/N, <P2[j][0],P2[j][1],P2[j][2]>
  #debug concat("helix = ", str(j/N,0,-1)," ", str(P2[j][0],0,-1)," ",
str(P2[j][1],0,-1)," ",  str(P2[j][2],0,-1), "\n")
  #declare j=j+1;
         }
#end

//place objects along helix ---------------------------------------
#declare helix_object =
 sphere { <0,0,0>, 0.2
          texture {pigment { Green }  finish { ambient 0.1 diffuse 0.5  phong
..4}
                  }
        }

/*
 #declare cnt=0;
 #while (cnt<1)
  object { helix_object
          translate helix_spline1(cnt   )
         }
  #declare cnt = cnt + 0.1;
 #end
*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.