iwmlib/lib/pixi/maps/projections/robinsontest.html

50 lines
1.1 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="../../../3rdparty/highlight/styles/default.css" />
<link rel="stylesheet" href="../../../../css/doctest.css" />
<script src="../../../../dist/iwmlib.3rdparty.js"></script>
<script src="../../../../dist/iwmlib.js"></script>
<script src="../../../../dist/iwmlib.pixi.js"></script>
</head>
<body>
<section id="solution">
</section>
<script>
function write(msg) {
if (typeof msg === "object") {
msg = JSON.stringify(msg)
}
let log = document.createElement("p")
log.innerHTML = msg
solution.appendChild(log)
}
let coords = { x: -30, y: -30 }
write(coords)
let robinson = new Projection.Robinson()
let pixels = robinson.forward(coords)
write(pixels)
coords = robinson.backwards(pixels)
write(coords)
</script>
</body>
</html>