.. | .. |
---|
3247 | 3247 | max = ay; |
---|
3248 | 3248 | } |
---|
3249 | 3249 | |
---|
| 3250 | + if (max == 0) |
---|
| 3251 | + { |
---|
| 3252 | + uvmap[i2] = 0.5f; |
---|
| 3253 | + uvmap[i2+1] = 0.5f; |
---|
| 3254 | + continue; |
---|
| 3255 | + } |
---|
| 3256 | + |
---|
3250 | 3257 | x /= max; |
---|
3251 | 3258 | y /= max; |
---|
3252 | 3259 | |
---|
3253 | 3260 | double angle = Math.acos(Math.abs(z*2)); |
---|
3254 | 3261 | |
---|
3255 | 3262 | double k = angle / Math.PI * 2; |
---|
| 3263 | + |
---|
| 3264 | + assert(k >= 0); |
---|
3256 | 3265 | |
---|
3257 | 3266 | // k == 0 => uv = 0 (center) |
---|
3258 | 3267 | // k == 1 => uv = -1,1 (border) |
---|
.. | .. |
---|
3268 | 3277 | t = Math.pow(t, 3); |
---|
3269 | 3278 | |
---|
3270 | 3279 | // Interpolate between k/length2 (center) and k (border) |
---|
3271 | | - k = k / length2 * (1 - t) + k * t; |
---|
| 3280 | + if (length2 > 0) |
---|
| 3281 | + k *= (1 - t) / length2 + t; |
---|
3272 | 3282 | |
---|
3273 | 3283 | double u = k*x; |
---|
3274 | 3284 | double v = k*y; |
---|
.. | .. |
---|
6344 | 6354 | |
---|
6345 | 6355 | void InitWeights() |
---|
6346 | 6356 | { |
---|
| 6357 | + new Exception().printStackTrace(); |
---|
6347 | 6358 | System.exit(0); |
---|
6348 | 6359 | int n = 0; |
---|
6349 | 6360 | int b = 0; |
---|