Revision: 52452
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52452
Author: psy-fi
Date: 2012-11-21 21:42:07 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
Fix: Normal maps and triangulate modifier will give incorrect result on
rectangular faces after applying rotation, reported by Metalliandi
This issue is caused by floating point precision error. After applying
rotation, the edge lengths change slightly and on rectangular faces the
length comparison can be flipped. Solved by giving a slight offset to
the length calculation for the diagonal during triangulation
calculation. (Same as done during uv unwrapping)
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c 2012-11-21
19:08:27 UTC (rev 52451)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c 2012-11-21
21:42:07 UTC (rev 52452)
@@ -677,6 +677,7 @@
BMLoop *l_first;
const float cos_threshold = 0.9f;
+ const float bias = 1.0f + 1e-6f;
if (f->len == 4) {
BMLoop *larr[4];
@@ -691,7 +692,7 @@
/* pick 0/1 based on best lenth */
/* XXX Can't only rely on such test, also must check we do not
get (too much) degenerated triangles!!! */
i = (((len_squared_v3v3(larr[0]->v->co, larr[2]->v->co) >
- len_squared_v3v3(larr[1]->v->co, larr[3]->v->co))) !=
use_beauty);
+ len_squared_v3v3(larr[1]->v->co, larr[3]->v->co) * bias))
!= use_beauty);
i4 = (i + 3) % 4;
/* Check produced tris aren’t too flat/narrow...
* Probably not the best test, but is quite efficient and
should at least avoid null-area faces! */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs