[Bf-python] Incorrect checking for zero length vector
Gilbert, Joseph
jgilbert at tigr.ORG
Fri Oct 7 16:27:57 CEST 2005
This is the expected behavior that we talked about earlier. A
zero-length vector is not really a vector at all :) (well sort of) and
it is not possible to calculate the angle between a real vector and what
is essentially nothing - thus raising an error.
Maybe a test could be: (?)
If v1.length is not 0 and v2.length is not 0:
...angle = AngleBetweenVecs(v1,v2)
Else:
...raise AttributeError, 'Something went wrong'
Print angle
-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Campbell
Barton
Sent: Thursday, October 06, 2005 7:57 PM
To: bf-python at blender.org
Subject: [Bf-python] Incorrect checking for zero length vector
Found that AngleBetweenVecs raises an error when checking for a zero
length Vector
# Heres my test from the interactive console.
print Mathutils.AngleBetweenVecs(Mathutils.Vector(10.0, 0 , 0),
Mathutils.Vector(0,1,0))
exceptions.AttributeError: Mathutils.AngleBetweenVecs(): zero-length
vectors not acceptable
- Cam
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
_______________________________________________
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