POV-Ray : Newsgroups : povray.general : Is Basic language array to POV array possible? Server Time
9 Aug 2024 03:20:15 EDT (-0400)
  Is Basic language array to POV array possible? (Message 1 to 6 of 6)  
From: Bob Hughes
Subject: Is Basic language array to POV array possible?
Date: 9 Sep 2000 12:25:51
Message: <39ba648f@news.povray.org>
I was trying to convert some Basic programming language arrays to POV arrays
and it hasn't worked.  Does anyone have experience with doing this yet?  An
example of what I'm doing is like so:

A(I)  // in Basic, after being DIM first as A(15).

A[I] // in POV, initialized as A[15]

All I get is subscript out of range error.  "I" is the incremental value
done in a loop.

Hope someone can at least tell me it's impossible if nothing else.  It's
entirely possible that I've got a bad pov script as well so far but the
error seems to isolate at the array.  If arrays can't accept variables in
this way I didn't figure that out from the documentation.  I also made a
quick search of these newsgroups and didn't see any Basic to POV array
converting mentioned.  Perhaps I overlooked it though.
TIA anyone.

Bob
--
omniVerse http://users.aol.com/persistenceofv/all.htm


Post a reply to this message

From: Dave Blandston
Subject: Re: Is Basic language array to POV array possible?
Date: 9 Sep 2000 12:45:50
Message: <39ba693e@news.povray.org>
"Bob Hughes" <per### [at] aolcom?subject=PoV-News:> wrote in message
news:39ba648f@news.povray.org...
> I was trying to convert some Basic programming language arrays to POV
arrays
> and it hasn't worked.  Does anyone have experience with doing this yet?

Without seeing your code, here's one suggestion: POV arrays go from [0 ..
n-1] when n is the number you use to declare the array, so if you want an
array of 15 elements the valid indexes are 0 through 14. If this doesn't
help I will be glad to look at your code, because I first programmed my
stone wall macro in Basic then converted it to POV, and it uses arrays.

Regards,
Dave


Post a reply to this message

From: Bob Hughes
Subject: Re: Is Basic language array to POV array possible?
Date: 9 Sep 2000 13:09:52
Message: <39ba6ee0@news.povray.org>
"Dave Blandston" <gra### [at] earthlinknet> wrote in message
news:39ba693e@news.povray.org...
| "Bob Hughes" <per### [at] aolcom?subject=PoV-News:> wrote in message
| news:39ba648f@news.povray.org...
| > I was trying to convert some Basic programming language arrays to POV
| arrays
| > and it hasn't worked.  Does anyone have experience with doing this yet?
|
| Without seeing your code, here's one suggestion: POV arrays go from [0 ..
| n-1] when n is the number you use to declare the array, so if you want an
| array of 15 elements the valid indexes are 0 through 14. If this doesn't
| help I will be glad to look at your code, because I first programmed my
| stone wall macro in Basic then converted it to POV, and it uses arrays.

Oh, thanks Dave, well yeah I did make sure it started at zero anyway.
Beyond that I'm lost.  This is the pertinent portion:

#declare I=0;
#while (IT<=NRS)
#declare T=(IT-1)*360/NRS;
#declare T1=3.141590*(T-TH)/180;
#declare X[I]=R*cos(T/5.729579)+150;
#declare Y[I]=R*sin(T/5.729579)+100;
#declare Z[I]=0;
#declare VX[I]=-V*sin(T1);
#declare VY[I]=V*cos(T1);
#declare VZ[I]=0;
#declare I=int(I+1);
#end // IT

Just seems to me that the array doesn't want a variable, or rather that I
don't understand the differences at all.  The Basic way is to store each
instance as you probably know.  I never have used the POV array before and
it acts as though it can't store a number in this way.
Glad you know this sort of thing.  You might want to see the whole file, I'm
still trying to figure how to best apply it in POV.

Bob


Post a reply to this message

From: Dave Blandston
Subject: Re: Is Basic language array to POV array possible?
Date: 9 Sep 2000 13:43:26
Message: <39ba76be@news.povray.org>
"Bob Hughes" <per### [at] aolcom?subject=PoV-News:> wrote in message
news:39ba6ee0@news.povray.org...
> This is the pertinent portion:
>
> #declare I=0;
> #while (IT<=NRS)
> #declare T=(IT-1)*360/NRS;
> #declare T1=3.141590*(T-TH)/180;
> #declare X[I]=R*cos(T/5.729579)+150;
> #declare Y[I]=R*sin(T/5.729579)+100;
> #declare Z[I]=0;
> #declare VX[I]=-V*sin(T1);
> #declare VY[I]=V*cos(T1);
> #declare VZ[I]=0;
> #declare I=int(I+1);
> #end // IT

Here's the problem: The variables "IT" and "NRS" don't change inside the
#while loop, so you have an infinite loop, so "I" will increment beyond the
limits of your array.

-Dave


Post a reply to this message

From: Bob Hughes
Subject: Re: Is Basic language array to POV array possible?
Date: 9 Sep 2000 14:02:35
Message: <39ba7b3b@news.povray.org>
"Dave Blandston" <gra### [at] earthlinknet> wrote in message
news:39ba76be@news.povray.org...
|
| Here's the problem: The variables "IT" and "NRS" don't change inside the
| #while loop, so you have an infinite loop, so "I" will increment beyond
the
| limits of your array.

So right you are.  I found many such problems with the rest of it too.  I
may be back :-)
Or I might just send this file over to you to mess with if you want.  If it
works it would be great.

Bob


Post a reply to this message

From: Dave Blandston
Subject: Re: Is Basic language array to POV array possible?
Date: 9 Sep 2000 14:54:03
Message: <39ba874b$1@news.povray.org>
"Bob Hughes" <per### [at] aolcom?subject=PoV-News:> wrote in message
news:39ba7b3b@news.povray.org...
> Or I might just send this file over to you to mess with if you want.  If
it
> works it would be great.

Sure, sounds exciting!


Post a reply to this message

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