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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-08-24 17:29:48 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-08-24 17:29:48 +0400
commitb30da4d58f4f5b24f902d8f2fa7d04e4406536ac (patch)
tree2e8e3424791b62f60e1cd7e4fc43b2f71ffa1a98 /source/blender/editors/uvedit
parentaba2754a1968fdbdcf69556c3cc1cedba6d76fda (diff)
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.
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 2161d4989db..72c38be5398 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -1135,7 +1135,11 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3)
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