POV-Ray : Newsgroups : povray.general : A painful lesson regarding function arguments. u=x, v=y. : A painful lesson regarding function arguments. u=x, v=y. Server Time
16 Apr 2024 03:37:37 EDT (-0400)
  A painful lesson regarding function arguments. u=x, v=y.  
From: William F Pokorny
Date: 27 Sep 2021 09:39:29
Message: <6151c991$1@news.povray.org>
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.


Post a reply to this message

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