POV-Ray : Newsgroups : povray.beta-test : vnormalize : Re: vnormalize Server Time
29 Jul 2024 14:18:40 EDT (-0400)
  Re: vnormalize  
From: Tim Nikias
Date: 22 Apr 2002 00:27:47
Message: <3C9AC0CD.62B9B9E6@gmx.de>
I think the problem isn't the value being returned, but the
internal mess POV-Ray creates to its own internal
data. Like setting a switch when calculating vnormalize
with <0,0,0> which just rips the scene apart.

Thats my experience, calculation works fine, but the
output image is worthless, because objects get deleted,
cut in half or appear as ghosts, but never moved around
to where they shouldn't belong.
I wrote a macro:

#macro VNormalize(_vec)
 #if (vlength(_vec)!=0)
 #local _ret=vnormalize(_vec);
#else
 #local _ret=<0,0,0>;
#end
//Return value:
_ret
#end


Then I simply replaced vnormalize() with VNormalize,
and everything works fine. You could also use any
other value than the above given <0,0,0>, in case
you're in dire need for a unit-length-vector.

Mike Williams wrote:

> Can anyone remind me what vnormalize(<0,0,0>) used to return under
> previous betas?
>
> I'm trying to get some code (actually Ingo's "param.inc" macro) to work
> the same under RC2 as it did before vnormalize(<0,0,0>) became an error.
>
> The docs say "A/vlength(A)", so I tried replacing
>      #declare Norm=vnormalize(vcross(A,B));
> with
>      #declare Norm = vcross(A,B)/vlength(vcross(A,B));
>
> V3.1 returned <0,0,0>. so I tried
>    #if (vlength(vcross(A,B))=0)
>      #declare Norm=<0,0,0>;
>    #else
>      #declare Norm=vnormalize(vcross(A,B));
>    #end
>
> but neither of these produce images that look quite the same as in
> previous betas.
>

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde


Post a reply to this message

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