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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c11
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c3
2 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 4a18987e2e4..135050f4a3f 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -934,6 +934,17 @@ MINLINE bool compare_len_v3v3(const float v1[3], const float v2[3], const float
return ((x * x + y * y + z * z) <= (limit * limit));
}
+MINLINE bool compare_len_squared_v3v3(const float v1[3], const float v2[3], const float limit_sq)
+{
+ float x, y, z;
+
+ x = v1[0] - v2[0];
+ y = v1[1] - v2[1];
+ z = v1[2] - v2[2];
+
+ return ((x * x + y * y + z * z) <= limit_sq);
+}
+
MINLINE bool compare_v4v4(const float v1[4], const float v2[4], const float limit)
{
if (fabsf(v1[0] - v2[0]) <= limit)
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 814649c7dbf..954f31fc4a8 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -528,6 +528,7 @@ static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
int i, j, keepvert = 0;
const float dist = BMO_slot_float_get(op->slots_in, "dist");
+ const float dist_sq = dist * dist;
const float dist3 = dist * 3.0f;
/* Test whether keep_verts arg exists and is non-empty */
@@ -576,7 +577,7 @@ static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
continue;
}
- if (compare_len_v3v3(v_check->co, v_other->co, dist)) {
+ if (compare_len_squared_v3v3(v_check->co, v_other->co, dist_sq)) {
/* If one vert is marked as keep, make sure it will be the target */
if (BMO_elem_flag_test(bm, v_other, VERT_KEEP)) {