|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tying to create a macro that use a array I've a problem.
Having the following code
#declare Numberofdigits = 10
#declare digits = 1,20,10,4,5,3,87,8,21,4
How can I put this variable number of digits into an array?
Roland
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <386908a5.2657716@news.povray.org>,
rol### [at] pingbe (Roland Vansteenkiste) wrote:
>Tying to create a macro that use a array I've a problem.
>Having the following code
>
>#declare Numberofdigits = 10
>#declare digits = 1,20,10,4,5,3,87,8,21,4
>
>How can I put this variable number of digits into an array?
>
>Roland
>
#declare myDigits = array[Numberofdigits] {
1,20,10,4,5,3,87,8,21,4
}
Jerry
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 28 Dec 1999 12:06:48 -0800, Jerry <jer### [at] acusdedu> wrote:
>In article <386908a5.2657716@news.povray.org>,
>rol### [at] pingbe (Roland Vansteenkiste) wrote:
>
>>Tying to create a macro that use a array I've a problem.
>>Having the following code
>>
>>#declare Numberofdigits = 10
>>#declare digits = 1,20,10,4,5,3,87,8,21,4
>>
>>How can I put this variable number of digits into an array?
>>
>>Roland
>>
>
>#declare myDigits = array[Numberofdigits] {
> 1,20,10,4,5,3,87,8,21,4
>}
>
>Jerry
Thanks Jerry, but I knew that answer. The meaning is that Pov does the
job and not me. How can I Pov make read the numbers and put them into
the array
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Roland Vansteenkiste <rol### [at] pingbe> wrote:
: How can I Pov make read the numbers
From where?
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Roland Vansteenkiste who wrote:
>On Tue, 28 Dec 1999 12:06:48 -0800, Jerry <jer### [at] acusdedu> wrote:
>
>>In article <386908a5.2657716@news.povray.org>,
>>rol### [at] pingbe (Roland Vansteenkiste) wrote:
>>
>>>Tying to create a macro that use a array I've a problem.
>>>Having the following code
>>>
>>>#declare Numberofdigits = 10
>>>#declare digits = 1,20,10,4,5,3,87,8,21,4
>>>
>>>How can I put this variable number of digits into an array?
>>>
>>>Roland
>>>
>>
>>#declare myDigits = array[Numberofdigits] {
>> 1,20,10,4,5,3,87,8,21,4
>>}
>>
>>Jerry
>
>Thanks Jerry, but I knew that answer. The meaning is that Pov does the
>job and not me. How can I Pov make read the numbers and put them into
>the array
>
If you'll accept digits as a string, then you can extract values from
its substrings. As it stands, I don't know what the incorrect
#declare digits = 1,20,10,4,5,3,87,8,21,4
is intended to mean.
#declare Numberofdigits = 10;
#declare digits = "1,20,10,4,5,3,87,8,21,4"
#declare MyArray = array[Numberofdigits]
// It's much easier if there's an extra comma at the end
// so we don't have to check for running off the end of the string
#declare MyDigits = concat(digits,",")
#declare C = 1; // start of substring
#declare K = 1; // end of substring
#declare N = 0;
#declare Comma = asc(",");
#while (N < Numberofdigits)
#while (asc(substr(MyDigits,K,1)) > Comma)
#declare K=K+1;
#end
#declare MyArray[N] = val(substr(MyDigits,C,K-C));
#end
--
Mike Williams #
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Roland Vansteenkiste wrote:
> Thanks Jerry, but I knew that answer. The meaning is that Pov does the
> job and not me. How can I Pov make read the numbers and put them into
> the array
external file I guess. Haven't looked into it. A looping readlin (or
comma recognizing routine) with an onerror flagging no more numbers. I
presume there is an onerror flag. (If not, make it a suggestion.)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 29 Dec 1999 07:33:37 +0000, Mike Williams <mik### [at] nospamplease>
wrote:
>Wasn't it Roland Vansteenkiste who wrote:
>>On Tue, 28 Dec 1999 12:06:48 -0800, Jerry <jer### [at] acusdedu> wrote:
>>
>>>In article <386908a5.2657716@news.povray.org>,
>>>rol### [at] pingbe (Roland Vansteenkiste) wrote:
>>>
>>>>Tying to create a macro that use a array I've a problem.
>>>>Having the following code
>>>>
>>>>#declare Numberofdigits = 10
>>>>#declare digits = 1,20,10,4,5,3,87,8,21,4
>>>>
>>>>How can I put this variable number of digits into an array?
>>>>
>>>>Roland
>>>>
>>>
>>>#declare myDigits = array[Numberofdigits] {
>>> 1,20,10,4,5,3,87,8,21,4
>>>}
>>>
>>>Jerry
>>
>>Thanks Jerry, but I knew that answer. The meaning is that Pov does the
>>job and not me. How can I Pov make read the numbers and put them into
>>the array
>>
>
>If you'll accept digits as a string, then you can extract values from
>its substrings. As it stands, I don't know what the incorrect
>
> #declare digits = 1,20,10,4,5,3,87,8,21,4
>
>is intended to mean.
>
>
>#declare Numberofdigits = 10;
>#declare digits = "1,20,10,4,5,3,87,8,21,4"
>
>#declare MyArray = array[Numberofdigits]
>// It's much easier if there's an extra comma at the end
>// so we don't have to check for running off the end of the string
>#declare MyDigits = concat(digits,",")
>
>#declare C = 1; // start of substring
>#declare K = 1; // end of substring
>#declare N = 0;
>#declare Comma = asc(",");
>
>#while (N < Numberofdigits)
> #while (asc(substr(MyDigits,K,1)) > Comma)
> #declare K=K+1;
> #end
> #declare MyArray[N] = val(substr(MyDigits,C,K-C));
>#end
>
Thanks Mike. Thats what I was looking for
Roland
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|