[Bf-python] BPython bug AngleBetweenVecs

Campbell Barton cbarton at metavr.com
Tue Mar 29 06:29:02 CEST 2005


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
 
- See the interactive console in action :)

--
Welcome Ideasman's Blender Console
 * Right Click:  Save output
 * Arrow Keys:  Command history and cursor
 * Ctrl + Tab:  Auto compleate based on variable names and modules 
loaded, multiple choices popup a menu
 * Ctrl + Enter:  Multiline functions, delays executing code until only 
Enter is pressed.
...Using existing console_autoexec.py in scripts dir
from Blender.Mathutils import *
a = Vector([3542345345435,4523452354234523,5645765756756])
a
[3542345318400.0000, 4523452576825344.0000, 5645765967872.0000]

b = Vector([3544562345345435,4523546452354234523,5645645765756756])
b
[3544562421202944.0000, 4523546417565794304.0000, 5645645926891520.0000]

AngleBetweenVecs(a,b)
nan

a
[0.0008, 1.0000, 0.0012]

b
[0.0008, 1.0000, 0.0012]

AngleBetweenVecs(a,b)
nan

AngleBetweenVecs(b,a)
nan





Campbell Barton wrote:

> Hi, this has caused me grief in the past and I have been using a 
> python version of AngleBetweenVecs.
>
> 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?\
>
> -Cam
> _______________________________________________
> 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