POV-Ray : Newsgroups : povray.advanced-users : Adding arrays Server Time
31 Oct 2024 19:29:05 EDT (-0400)
  Adding arrays (Message 1 to 4 of 4)  
From: John Greenwood
Subject: Adding arrays
Date: 21 Jan 2014 06:25:00
Message: <web.52de584ef79e1dbaa7cafab50@news.povray.org>
Is there a simple way to add two similar arrays, so that each element of the new
array is the sum of the corresponding elements in the two input arrays?


Post a reply to this message

From: clipka
Subject: Re: Adding arrays
Date: 21 Jan 2014 10:02:01
Message: <52de8be9@news.povray.org>
Am 21.01.2014 12:21, schrieb John Greenwood:
> Is there a simple way to add two similar arrays, so that each element of the new
> array is the sum of the corresponding elements in the two input arrays?

You mean, simpler than to #declare a new array of same size, and in a 
#for loop add all the corresponding entries?

Nope.


Post a reply to this message

From: John Greenwood
Subject: Re: Adding arrays
Date: 21 Jan 2014 12:10:01
Message: <web.52dea9df8afa3245a7cafab50@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 21.01.2014 12:21, schrieb John Greenwood:
> > Is there a simple way to add two similar arrays, so that each element of the new
> > array is the sum of the corresponding elements in the two input arrays?
>
> You mean, simpler than to #declare a new array of same size, and in a
> #for loop add all the corresponding entries?
>
> Nope.

Pity!

Thanks for quick reply.


Post a reply to this message

From: MichaelJF
Subject: Re: Adding arrays
Date: 21 Jan 2014 13:10:00
Message: <web.52deb7238afa3245b1b7147c0@news.povray.org>
"John Greenwood" <nomail@nomail> wrote:
>
> Pity!

I don't think so. In a special situation this task needs three lines of code. I
think this is a reasonable burden.

But if you will write a macro to do this simple job, you must distinguish
between local and global arrays as output. You must distinguish between the
different types of possible entries to your array. For some reasons you must add
a semicolon with certain types at the end of a #declare-statement but not with
others. I for myself have no idea how to code this with the SDL.

Best regards,
Michael


Post a reply to this message

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