POV-Ray : Newsgroups : povray.beta-test : vnormalize : Re: vnormalize Server Time
29 Jul 2024 14:15:57 EDT (-0400)
  Re: vnormalize  
From: Mike Williams
Date: 22 Apr 2002 02:34:43
Message: <8Y2EbIAfy6w8Ewv1@econym.demon.co.uk>
Wasn't it Tim Nikias who wrote:
>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.
>>
>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

As I said, I tried <0,0,0> (because that's what v3.1 returns) and the
resulting image doesn't look the same as it did in previous betas. 

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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