From bed42c663d286d76a32f155049f9efabc2fdb73f Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 28 Apr 2019 20:48:43 -0400 Subject: [PATCH] New UI proto --- BoundaryRep.java | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/BoundaryRep.java b/BoundaryRep.java index 05b3429..14a7921 100644 --- a/BoundaryRep.java +++ b/BoundaryRep.java @@ -3247,12 +3247,21 @@ max = ay; } + if (max == 0) + { + uvmap[i2] = 0.5f; + uvmap[i2+1] = 0.5f; + continue; + } + x /= max; y /= max; double angle = Math.acos(Math.abs(z*2)); double k = angle / Math.PI * 2; + + assert(k >= 0); // k == 0 => uv = 0 (center) // k == 1 => uv = -1,1 (border) @@ -3268,7 +3277,8 @@ t = Math.pow(t, 3); // Interpolate between k/length2 (center) and k (border) - k = k / length2 * (1 - t) + k * t; + if (length2 > 0) + k *= (1 - t) / length2 + t; double u = k*x; double v = k*y; -- Gitblit v1.6.2