diff options
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_remap.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_remap.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index a8937f74dee..f3b29171762 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -61,7 +61,12 @@ static bool mesh_remap_bvhtree_query_nearest(BVHTreeFromMesh *treedata, { /* Use local proximity heuristics (to reduce the nearest search). */ if (nearest->index != -1) { - nearest->dist_sq = min_ff(len_squared_v3v3(co, nearest->co), max_dist_sq); + nearest->dist_sq = len_squared_v3v3(co, nearest->co); + if (nearest->dist_sq > max_dist_sq) { + /* The previous valid index is too far away and not valid for this check. */ + nearest->dist_sq = max_dist_sq; + nearest->index = -1; + } } else { nearest->dist_sq = max_dist_sq; @@ -322,6 +327,7 @@ void BKE_mesh_remap_find_best_match_from_mesh(const MVert *verts_dst, /** \} */ +/* -------------------------------------------------------------------- */ /** \name Mesh to mesh mapping * \{ */ |