[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50185] trunk/blender/source/blender/ editors/uvedit/uvedit_parametrizer.c: Fix #32198: UV unwrap of half a UV sphere would not give a perfect sphere as a

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Aug 24 15:29:48 CEST 2012


Revision: 50185
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50185
Author:   blendix
Date:     2012-08-24 13:29:48 +0000 (Fri, 24 Aug 2012)
Log Message:
-----------
Fix #32198: UV unwrap of half a UV sphere would not give a perfect sphere as a
result. This wasn't really guaranteed anyway, because of numerical precision and
possible asymmetry in the triangulation, but we can do a bit better.

Now we bias the choice of how to split a quad into two triangles slightly
towards one of two possibilities, so that in case they are equal, floating point
errors do not decide the direction and symmetry is preserved.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c	2012-08-24 13:22:05 UTC (rev 50184)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c	2012-08-24 13:29:48 UTC (rev 50185)
@@ -1135,7 +1135,11 @@
 
 static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys)
 {
-	float fac = len_v3v3(co[0], co[2]) - len_v3v3(co[1], co[3]);
+	/* slight bias to prefer one edge over the other in case they are equal, so
+	 * that in symmetric models we choose the same split direction instead of
+	 * depending on floating point errors to decide */
+	float bias = 1.0f + 1e-6f;
+	float fac = len_v3v3(co[0], co[2])*bias - len_v3v3(co[1], co[3]);
 	PBool dir = (fac <= 0.0f);
 
 	/* the face exists check is there because of a special case: when




More information about the Bf-blender-cvs mailing list