MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / projectPoint

Function projectPoint

freebuff/web/src/app/live/live-client.tsx:55–79  ·  view source on GitHub ↗
(lat: number, lon: number)

Source from the content-addressed store, hash-verified

53}
54
55function projectPoint(lat: number, lon: number) {
56 const lambda = (lon * Math.PI) / 180
57 const phi = (lat * Math.PI) / 180
58 const theta = Math.asin((Math.sqrt(3) / 2) * Math.sin(phi))
59 const theta2 = theta * theta
60 const theta6 = theta2 * theta2 * theta2
61 const theta8 = theta6 * theta2
62 const x =
63 (2 * Math.sqrt(3) * lambda * Math.cos(theta)) /
64 (3 *
65 (9 * EQUAL_EARTH.a4 * theta8 +
66 7 * EQUAL_EARTH.a3 * theta6 +
67 3 * EQUAL_EARTH.a2 * theta2 +
68 EQUAL_EARTH.a1))
69 const y =
70 EQUAL_EARTH.a1 * theta +
71 EQUAL_EARTH.a2 * theta * theta2 +
72 EQUAL_EARTH.a3 * theta * theta6 +
73 EQUAL_EARTH.a4 * theta * theta8
74
75 return {
76 x: ((x + EQUAL_EARTH.maxX) / (EQUAL_EARTH.maxX * 2)) * MAP_SIZE.width,
77 y: ((EQUAL_EARTH.maxY - y) / (EQUAL_EARTH.maxY * 2)) * MAP_SIZE.height,
78 }
79}
80
81function linePath(
82 from: { x: number; y: number },

Callers 2

live-client.tsxFile · 0.85
WorldMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected