|
![](/i/fill.gif) |
"geogeo" <geo### [at] mecol co uk> wrote:
> 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
> */
Have now resolved this, seems the term natural_sline which I got from a tutorial
is the problem, changed it to quardratic_spline then no more crashes.
However the while loop surrounding the spline is flawed and doesn't define the
spline at all but a load of single point splines! Can't yet see a way to do this
without tediously defining each point - any ideas anyone?
Geo
Post a reply to this message
|
![](/i/fill.gif) |