RE: [AD] div-by-zero... math3d.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] div-by-zero... math3d.c

> I think you are right about the zero vector, we may well leave the
> result undefined.  But I also think the current
> implementation may give
> strange results for vectors close to but different from zero,
> because if
> their squares are zero then vector_length() returns zero.  What about
> the following algorithm:
[...]

Ah yes, this is something kinda something I saw in Numerical Recipes
in C. That'd certainly be helpful. Also, since it's often the case
that normalization is used, in fact, as renormalization (eg only for
vectors which are almost normalized already), I remember seeing yet
another trick, that is faster, but only works with almost normalized
vectors (and the precision is worse, too). I can't remember the kind
of speedup it offered though. Could be interesting to add, maybe ?

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/