POV-Ray : Newsgroups : povray.beta-test : vnormalize Server Time
29 Jul 2024 16:23:55 EDT (-0400)
  vnormalize (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: Mike Williams
Subject: vnormalize
Date: 21 Apr 2002 21:05:59
Message: <K0aJQDAtG2w8Ewq6@econym.demon.co.uk>
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.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Tim Nikias
Subject: Re: vnormalize
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

From: Mike Williams
Subject: Re: vnormalize
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

From: Warp
Subject: Re: vnormalize
Date: 22 Apr 2002 03:48:13
Message: <3cc3c03d@news.povray.org>
Mike Williams <mik### [at] nospamplease> wrote:

> Can anyone remind me what vnormalize(<0,0,0>) used to return under
> previous betas?

  AFAIK, it returned <NaN, NaN, NaN>, which is obviously not usable.

  (NaN, that is, "Not a Number" is a special floating point value returned
by the math co-processor which means that it's the result of an illegal
operation, which can't have a result.)

  vnormalize(<0,0,0>) can't have a legal return value and thus issuing an
error is the correct behaviour.
  The reason is exactly the same as why 1/0 can't have a legal value.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: ingo
Subject: Re: vnormalize
Date: 22 Apr 2002 06:52:01
Message: <Xns91F88355A8E3seed7@povray.org>
in news:K0a### [at] econymdemoncouk Mike Williams wrote:

> 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. 
> 

Mike,

There should be no need to catch vnormalize(0), unless you calculate 
points that don't "resolve" somehow, stuff like lim->0. Using the FromU
() etc. macros helps. See below example (from a somewhat more recent 
version):

#declare R=1;
#declare F1=function(U,V){R*sin(V)*cos(U)}
#declare F2=function(U,V){R*cos(V)}
#declare F3=function(U,V){R*sin(V)*sin(U)}
object { 
  Parametric (
    F1, F2, F3,
    <0, 2*pi>,
    <FromV(0), pi>, //<0,pi> results in an error
    100,50,""
  )
  pigment {rgb 1}
  finish{specular 0.3}
  rotate <0,0,0>
}

Ingo


Post a reply to this message

From: Mike Williams
Subject: Re: vnormalize
Date: 22 Apr 2002 13:37:45
Message: <cW9soGA0REx8EwjA@econym.demon.co.uk>
Wasn't it ingo who wrote:
>in news:K0a### [at] econymdemoncouk Mike Williams wrote:
>
>> 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. 
>> 
>
>Mike,
>
>There should be no need to catch vnormalize(0), unless you calculate 
>points that don't "resolve" somehow, stuff like lim->0. Using the FromU
>() etc. macros helps. See below example (from a somewhat more recent 
>version):
>
>#declare R=1;
>#declare F1=function(U,V){R*sin(V)*cos(U)}
>#declare F2=function(U,V){R*cos(V)}
>#declare F3=function(U,V){R*sin(V)*sin(U)}
>object { 
>  Parametric (
>    F1, F2, F3,
>    <0, 2*pi>,
>    <FromV(0), pi>, //<0,pi> results in an error
>    100,50,""
>  )
>  pigment {rgb 1}
>  finish{specular 0.3}
>  rotate <0,0,0>
>}
>
>Ingo

I would prefer to retain the "param.inc" versions of the examples on my
Isosurface tutorial page, because they are so much faster than real
parametrics. At the moment over half of them fail to run under RC2.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: vnormalize
Date: 22 Apr 2002 13:45:17
Message: <3cc44c2d@news.povray.org>
In article <3C9AC0CD.62B9B9E6@gmx.de> , Tim Nikias <tim### [at] gmxde>  wrote:

> I think the problem isn't the value being returned, but the
> internal mess POV-Ray creates to its own internal data.

There is no "internal mess" - POV-Ray works perfectly in this case.

> 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.

That is plain wrong!!!  They simply appear misplaced because they are at
invalid positions.  There is *no* valid output for vnormalize(0) because you
cannot normalize a zero-length vector as it is mathematically impossible!

    Thorsten

PS: Your date is by one month behind the real world :-)

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: vnormalize
Date: 22 Apr 2002 13:48:57
Message: <3cc44d09@news.povray.org>
In article <3cc3c03d@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

>   AFAIK, it returned <NaN, NaN, NaN>, which is obviously not usable.

Unfortunately, the Windows version did not because of a not correctly
implemented standard math library "pow" function in Visual C (the library is
used in both compiles).

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Tim Nikias
Subject: Re: vnormalize
Date: 22 Apr 2002 13:54:24
Message: <3CC44E3B.C2AC4E53@gmx.de>
I've checked my code and the examples I've given to
state what I said.

For one: If objects are misplaced, that may be the case.
But what do you make of the ghost-appearances?
Or parts of objects being cut off? That doesn't make much
sense, but I'm not into the POV-Code that much to
actually know if its not related somehow, at least internally.


Oh, and the month: I've been using the Beta 16 for the photons,
and the RC1 for other tests (aside radiosity), so sometimes the
month is wrong...

Thorsten Froehlich wrote:

> That is plain wrong!!!  They simply appear misplaced because they are at
> invalid positions.  There is *no* valid output for vnormalize(0) because you
> cannot normalize a zero-length vector as it is mathematically impossible!
>
>     Thorsten
>
> PS: Your date is by one month behind the real world :-)
>

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


Post a reply to this message

From: ingo
Subject: Re: vnormalize
Date: 22 Apr 2002 14:12:54
Message: <Xns91F8CE14C253Aseed7@povray.org>
in news:cW9### [at] econymdemoncouk Mike Williams wrote:

> I would prefer to retain the "param.inc" versions of the examples on
> my Isosurface tutorial page, because they are so much faster than
> real parametrics. At the moment over half of them fail to run under
> RC2. 
> 

Think you misunderstood me, the code was from an newer version of
param.inc that accepts functions directly and looks even more like the
parametric object. 

Now to one of your example files (IngoSpline04b.pov), it uses the cubic
spline that returns the same value in the range t=-1 to 0 and t=17 to
18. This results in the vnormalize error. Two solutions: 

1. use an other spline type.

2. move #include "param.inc" to the top of the file,
   change Umin and Umax to:
   #declare Umin =  FromU(0);
   #declare Umax =  ToU(17);

Ingo


Post a reply to this message

Goto Latest 10 Messages Next 4 Messages >>>

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