|
![](/i/fill.gif) |
Karl J. Anders <kar### [at] web de> wrote:
> - the often discussed problem about vnormalize( <0,0,0> ) = 0
You complain that vnormalize(<0,0,0>) returns an error, yet you don't
complain that 1/0 returns an error.
However, they are practically the same thing (the vnormalize also performs
a division by 0, as it divides each component with the length of the vector,
which is 0).
1/0 is undefined. It has no value in the set of real numbers (or even the
set if imaginary numbers for that matter). Everyone accepts that.
vnormalize(<0,0,0>) is undefined in the exact same way. There's no
unit-sized vector which would have the same direction as <0,0,0>, because
<0,0,0> has no direction nor length.
If vnormalize(<0,0,0>) returns *any* value at all, that's just plain WRONG
(in the exact same way as 1/0 returning any value would be wrong). The value
it returns is *not* the correct answer. Thus, if it returns a value, it
would malfunction; it would work against its specification.
If you try to normalize a zero vector, that's an error and the correct
behaviour for POV-Ray is to issue an error message, in the exact same way
as trying to divide by 0 is an error.
Avoiding the error is as simple as avoiding division by 0.
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
![](/i/fill.gif) |