(lon, lat, z)
| 50 | } |
| 51 | |
| 52 | export const pointToCamera = (lon, lat, z) => { |
| 53 | const sin = Math.sin(lat * d2r) |
| 54 | const z2 = Math.pow(2, z) |
| 55 | |
| 56 | let x = z2 * (lon / 360 + 0.5) |
| 57 | let y = z2 * (0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI) |
| 58 | |
| 59 | x = x % z2 |
| 60 | y = Math.max(Math.min(y, z2), 0) |
| 61 | if (x < 0) x = x + z2 |
| 62 | return [x, y, z] |
| 63 | } |
| 64 | |
| 65 | export const cameraToPoint = (x, y, z) => { |
| 66 | const z2 = Math.pow(2, z) |
no outgoing calls
no test coverage detected