POV-Ray : Newsgroups : povray.general : Pass array to macro. : Re: Pass array to macro. Server Time
24 Apr 2024 20:06:57 EDT (-0400)
  Re: Pass array to macro.  
From: kurtz le pirate
Date: 14 Apr 2020 06:04:28
Message: <5e958aac$1@news.povray.org>
On 12/04/2020 14:14, Bald Eagle wrote:
> 
> Hard to understand exactly what you mean, but:
> All you do is pass the FULL array into the macro and then define the way you
> address the parts of the array that you want to access.

My ListOfLines = array[nbLines][2] is just and array of N lines and for 
each line, the start point "array[i][0]" and the end point "array[i][1]".

In my mind, passing array[i], allowed me to pass the two parameters 
present in the second dimension.

> If you only want to access the second dimension, then just hold the first one
> constant, but you do have to put that into your ArrayName [index1][index2]
> designation.
>  
>> you could declare an array of arrays, ie
>> #declare ListOfLines = array [N] {
>>    array [2] {point, point},
>>    ...
>>    array [2] {point, point}
>> };

"array of arrays" is not the same as array[][] ?

> This I think would also be a way to avoid the error, and might be better, as you
> can then have a parent array that is composed of sub-arrays of _different data
> types_.:)

For now, the simplest way is to pass two parameters to my macro.
drawLine(ListOfLines[lineIndex][0],ListOfLines[lineIndex][1],0.05, 
GreenYellow)

with :
#macro drawLine(thisLineStart, thisLineEnd, lRadius, lColor)


No more complications. Thankss

-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

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