|  |  | Wasn't it Leo80s who wrote:
>Hello everybody,
>
>In my .pov fil I've defined a function in this way:
>
>#declare dist = function(x1,y1,z1,x2,y2,z2)
>      { sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2) ) };
>(I hope It's right !!!)
>
>When I try to use this in the code (the framment is reported above)...
>
>#macro W (k,X,Y,Z)
>       #local
>distanza=dist(X,Y,Z,coordinate[k][0],coordinate[k][1],coordinate[k][2]);
>       #if (distanza<1.0E-7)
>                #declare result=1;
>       #else
>                #declare numeratore=pos(raggi[k]-distanza);
>                #declare denominatore=raggi[k]*distanza;
>                #declare result= numeratore / denominatore;
>       #end
>       result
>#end
>
>.... I have an error like in subject...
>can anybody help me, please?
>
>PS: I think that perhaps parameter X,Y,Z are treated by pov-ray like
>non-initializated identifiers...is it right?
There's nothing wrong with that code in itself, as long as everything it
uses are floats and not vectors. 
You'll get that error if X, or Y or Z are vectors
       or if coordinate[][] is an array of vectors
           because you can't use vectors in a user defined function
       or if raggi[] is an array of vectors
           because then denominatore would be a vector, and you can't
           divide by a vector
-- 
Mike Williams
Gentleman of Leisure
Post a reply to this message
 |  |