Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-28 22:27:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-28 22:27:06 +0300
commit545591727446bbc553b0cfb0cc9b6fefd2a16d9e (patch)
tree3b8a9909c0a69fd9a89630be9efb08f9932a8e0e /source/blender/python/generic/vector.c
parent9e357770197f46f2e36acc4f1c02daee551e22e6 (diff)
comparing Vector(-2, 0, 0) and Vector(2, 0, 0) was returning true, this bug is years old, strange nobody noticed.
use float comparison from the "Ever Faster Float Comparisons" paper, tested with random values as well as random values converted to ints (where this existing code would fail).
Diffstat (limited to 'source/blender/python/generic/vector.c')
-rw-r--r--source/blender/python/generic/vector.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/source/blender/python/generic/vector.c b/source/blender/python/generic/vector.c
index 1e44ddafd37..e320f87e9b9 100644
--- a/source/blender/python/generic/vector.c
+++ b/source/blender/python/generic/vector.c
@@ -1252,12 +1252,7 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
result = EXPP_VectorsAreEqual(vecA->vec, vecB->vec, vecA->size, 1);
break;
case Py_NE:
- result = EXPP_VectorsAreEqual(vecA->vec, vecB->vec, vecA->size, 1);
- if (result == 0){
- result = 1;
- }else{
- result = 0;
- }
+ result = !EXPP_VectorsAreEqual(vecA->vec, vecB->vec, vecA->size, 1);
break;
case Py_GT:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);