POV-Ray : Newsgroups : povray.general : Github repository with useful macros : Re: Github repository with useful macros Server Time
4 May 2024 08:38:15 EDT (-0400)
  Re: Github repository with useful macros  
From: William F Pokorny
Date: 22 May 2021 19:26:26
Message: <60a99322$1@news.povray.org>
On 5/22/21 6:14 PM, Tor Olav Kristensen wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
...
> 
> I'll have a look at the code you have made so far to see if we are on the same
> track.
> 
...

FWIW. There is some type checking available via POV-Ray's fixed arrays.

For example, a method to keep all subsequent array types the same as the 
first seen, when passed a mixed array, the Mean() macro would become:

#macro Mean(Values)

    #local N = dimension_size(Values, 1);
// #local Sum = Values[0];
    #local Sum = array[1]
    #local Sum[0] = Values[0];
    #for (I, 1, N - 1)
       #local Sum[0] = Sum[0] + Values[I];
    #end // for

    (Sum[0]/N)

#end // macro Mean

On changes in type for the incoming mixed array 'Values' you'd get 
messages like:

File 'dimsize.inc' line 52:
Parse Error:
Attempted to redefine float identifier as uv vector identifier.

Bill P.


Post a reply to this message

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