[Bf-python] BPython bug AngleBetweenVecs

Campbell Barton cbarton at metavr.com
Wed Mar 30 23:47:52 CEST 2005


Did you commit the changes? - just compiled CVS
Im not getting nan for comparing a vector against its self-
But getting nan for comparing
Vectors (0,0,0) with (0,0,1)

and its still normalizing the Vector data of the vars passed.
- Cam


Gilbert, Joseph wrote:

>//Just now I found the problem. when AngleBetweenVecs compares 2 vectors
>
>//that are the same, it can return  nan, nan being a float type. nothing
>is //equal to nan except float('nan'). Shold be changed to return 0
>instead of //nan?
>
>I fixed this and the fix will be applied. I think in part
>angleBetweenVecs was choking on a few things. First is the arc-cosine
>function it was using (you may not be using the lastest cvs) and also
>the float precision of the angle it was returning.
>
>//Also discovered AngleBetweenVecs() can return NAN for very large
>numbers. //Another very bad thing us that AngleBetweenVecs() modifies
>the 2 vectors 
>//(normalizes them I think) when it should realy be normalizing a copy
>of 
>//the data
>
>VERY GOOD CATCH
>The normalization should not be applied directly to the vector. FIXED
>The very large number issue is resolved to a degree with full double
>precision now.
>
>//Incidentally, this is (IMHO) where we need some regression tests.  I
>don't //think that a general math function like AngleBetweenVecs (with
>no GUI //dependencies, etc) should be committed without a decent set of
>regression //tests that run on it and test for odd cases like finding
>the angle between //a vector and itself.  Functions like this should be
>absolutely rock-solid, //watertight, bulletproof, leak-proof, cast iron
>pieces of... well you get //the idea. :-)
>
>If you're volunteering your services for beta testing let us know.
>
>
>_______________________________________________
>Bf-python mailing list
>Bf-python at projects.blender.org
>http://projects.blender.org/mailman/listinfo/bf-python
>
>
>  
>




More information about the Bf-python mailing list