POV-Ray : Newsgroups : povray.general : <no subject> Server Time
26 Nov 2024 07:32:28 EST (-0500)
  <no subject> (Message 1 to 5 of 5)  
From: jkennedy12
Subject: <no subject>
Date: 16 Apr 2011 20:20:01
Message: <web.4daa31fec23a6d93c82a5bf0@news.povray.org>
This is part of the code I'm writing.

#declare RailArray = array[N];
#declare tmp = 0;
#while(tmp<=N)
        #declare RailArray[temp] = 0//Spline_1(temp/N);
#end

It gives me an error when I call the part inside the loop. N is equal to 10.
Spline_1 is obviously a spline. I can't figure out why it doesn't like this.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: <no subject>
Date: 16 Apr 2011 21:45:00
Message: <web.4daa44f76f92e856b05ef170@news.povray.org>
"jkennedy12" <jke### [at] cornellcollegeedu> wrote:
> This is part of the code I'm writing.
>
> #declare RailArray = array[N];
> #declare tmp = 0;
> #while(tmp<=N)
>         #declare RailArray[temp] = 0//Spline_1(temp/N);
> #end
>
> It gives me an error when I call the part inside the loop. N is equal to 10.
> Spline_1 is obviously a spline. I can't figure out why it doesn't like this.

Array indexes are 0 based, so an array of dimension N goes from 0 to 1-N.

Try: #while(tmp<N)

-tgq


Post a reply to this message

From: Slime
Subject: Re: <no subject>
Date: 17 Apr 2011 21:08:54
Message: <4dab8f26$1@news.povray.org>
> #declare RailArray = array[N];
 > #declare tmp = 0;
 > #while(tmp<=N)
 >          #declare RailArray[temp] = 0//Spline_1(temp/N);
 > #end


What is the error? It probably says what the problem is.

You're using "tmp" and then "temp", for one.

Also, you've removed the semicolon by commenting out the end of the line.

  - Slime


Post a reply to this message

From: Larry Hudson
Subject: Re: <no subject>
Date: 18 Apr 2011 03:40:02
Message: <4dabead2$1@news.povray.org>
...
> Array indexes are 0 based, so an array of dimension N goes from 0 to 1-N.

Array indexes are negative??
A little slip of the fingers there--of course you meant N-1.    ;-)

      -=- Larry -=-


Post a reply to this message

From: Stephen
Subject: Re: <no subject>
Date: 18 Apr 2011 07:40:21
Message: <4dac2325@news.povray.org>
On 18/04/2011 8:40 AM, Larry Hudson wrote:
> ....
>> Array indexes are 0 based, so an array of dimension N goes from 0 to 1-N.
>
> Array indexes are negative??
> A little slip of the fingers there--of course you meant N-1. ;-)
>


Good to see you dropping in Larry. I actually mentioned you by name in 

telling young Andrew (Invisible) how technology had changed in my 
lifetime. I wondered what your view was. If you have the time I would be 
interested to hear your Stories.

-- 
Regards
     Stephen


Post a reply to this message

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