MCPcopy Create free account
hub / github.com/Semporia/Scripts / getCoordinate

Function getCoordinate

jd_validate.js:274–318  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

272}
273
274function getCoordinate(c) {
275 function string10to64(d) {
276 let c = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~".split("")
277 , b = c.length
278 , e = +d
279 , a = [];
280 do {
281 mod = e % b;
282 e = (e - mod) / b;
283 a.unshift(c[mod])
284 } while (e);
285 return a.join("")
286 }
287
288 function prefixInteger(a, b) {
289 return (Array(b).join(0) + a).slice(-b)
290 }
291
292 function pretreatment(d, c, b) {
293 let e = string10to64(Math.abs(d));
294 let a = "";
295 if (!b) {
296 a += (d > 0 ? "1" : "0")
297 }
298 a += prefixInteger(e, c);
299 return a
300 }
301
302 let b = new Array();
303 for (let e = 0; e < c.length; e++) {
304 if (e == 0) {
305 b.push(pretreatment(c[e][0] < 262143 ? c[e][0] : 262143, 3, true));
306 b.push(pretreatment(c[e][1] < 16777215 ? c[e][1] : 16777215, 4, true));
307 b.push(pretreatment(c[e][2] < 4398046511103 ? c[e][2] : 4398046511103, 7, true))
308 } else {
309 let a = c[e][0] - c[e - 1][0];
310 let f = c[e][1] - c[e - 1][1];
311 let d = c[e][2] - c[e - 1][2];
312 b.push(pretreatment(a < 4095 ? a : 4095, 2, false));
313 b.push(pretreatment(f < 4095 ? f : 4095, 2, false));
314 b.push(pretreatment(d < 16777215 ? d : 16777215, 4, true))
315 }
316 }
317 return b.join("")
318}
319
320const HZ = 60;
321

Callers 1

runMethod · 0.70

Calls 1

pretreatmentFunction · 0.70

Tested by

no test coverage detected