POV-Ray : Newsgroups : povray.general : A painful lesson regarding function arguments. u=x, v=y. : Re: A painful lesson regarding function arguments. u=3Dx, v=3Dy. Server Time
18 Apr 2024 04:07:08 EDT (-0400)
  Re: A painful lesson regarding function arguments. u=3Dx, v=3Dy.  
From: Kenneth
Date: 27 Sep 2021 17:35:00
Message: <web.6152384a3077206f4cef624e6e066e29@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> Though long a user of user functions, today I ran face first into a
> parameter naming trap which had me tangled up for hours. Though perhaps
> not too surprising in hindsight, thought I'd pass along the lesson learned.
>
> Fn0 = function (x,y,z) {...} // OK. Pass anything you want for x,y,z.
>
> Fn1 = function (v) {...} // OK. Pass anything you want for v.
>
> Fn2 = function (x,y,z,v) // Boom! What you pass for v overwrites y.
>
> Looks to be related to u and v being synonyms for x and y. Something like:
>
> Fn3 = function (x,y,z,_v) {...} // OK. Pass what you want.
>
> Bill P.

Interesting! Thanks for the breakdown. I think I ran into a similar problem at
some point in the past year, but didn't try to pursue it (due to sheer lack of
understanding) and moved on.


Post a reply to this message

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