POV-Ray : Newsgroups : povray.general : Array scope/persistance and vtransform : Re: Array scope/persistance and vtransform Server Time
30 Jul 2024 12:27:28 EDT (-0400)
  Re: Array scope/persistance and vtransform  
From: clipka
Date: 1 Feb 2009 15:45:00
Message: <web.498609837696691ff8450bd80@news.povray.org>
"[GDS|Entropy]" <gds### [at] hotmailcom> wrote:
> I just want a List<T> right about now...

Yeah, I know that feeling ;) Some "foreach" would come in handy, too... oh, I
see you mention that in your post as well...


> List<vector> myList = new List<vector>();

#declare mySize = 6;
#declare myArray = array[mySize];

> while (n < 6)
> {

#declare n = 0;
#while (n < mySize)

>  myList.Add(<Math.Sin(n),n,Math.Cos(n)>)

  #declare myArray[i] = <sin(n),n,cos(n)>;

>  n++;

  #declare n = n + 1;

> }

#end


> foreach(vector v in myList)
> {

#declare n = 0;
#while (n < mySize)
  #declare v = myArray[n];

>  testRay(v,cam_pt,myObject)

  testRay(v,cam_pt,myObject)

> }

  #declare n = n + 1;
#end


> Is there a way to do this in povray?

See above. It *should* to the job, although I might have added some typos.

It gets somewhat problematic if you need to later add more elements to the array
though: There simply isn't such a thing as a List<T> in POV SDL.

> My second question: I have an object constructed thusly-I translate an
> object(a) into an "object(b) of objects(a)" in one loop, then translate that
> "object(b)" into an "object(c) of objects(b)". Is there a way using an array
> as specified above, to determine the end position in object(c) of each
> object(a) using vtransform (or something)? Am I close?

I must confess I haven't a clue what you intend to do. Can you try to rephrase
that?


> I am half considering just writing a freaking C# program to dump my vectors
> into a file, which I could import into povray...but thats a really ugly
> solution.

I think at times it's a much more beautiful one ;)


Post a reply to this message

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