Function
applyTransform
(u, v, scaleU, scaleV, offsetU, offsetV, cosR, sinR)
Source from the content-addressed store, hash-verified
| 317 | const ax2 = ax * ax, ay2 = ay * ay, az2 = az * az; |
| 318 | const bx = ax2 * ax2; |
| 319 | const by = ay2 * ay2; |
| 320 | const bz = az2 * az2; |
| 321 | const sum = bx + by + bz + 1e-6; |
| 322 | const wx = bx / sum; |
| 323 | const wy = by / sum; |
| 324 | const wz = bz / sum; |
| 325 | |
| 326 | // Flip U based on normal sign so opposite faces show correct (non-mirrored) text. |
| 327 | let yzU = (pos.y - min.y) / md; |
| 328 | if (normal.x < 0) yzU = -yzU; |
| 329 | let xzU = (pos.x - min.x) / md; |
| 330 | if (normal.y > 0) xzU = -xzU; |
| 331 | let xyU = (pos.x - min.x) / md; |
| 332 | if (normal.z < 0) xyU = -xyU; |
Tested by
no test coverage detected