@maplat/transform
Version:
A JavaScript library that performs coordinate transformation between two plane coordinate systems using transformation definitions generated by Maplat.
39 lines (35 loc) • 1.2 kB
HTML
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>MaplatTransform Test</title>
</head>
<body>
<h1>MaplatTransform Test</h1>
<div id="output"></div>
<script type="module">
import { Transform as Tin } from '/src/index.ts';
const tin = new Tin({
bounds: [[100, 50], [150, 150], [150, 200], [60, 190], [50, 100]],
strictMode: Tin.MODE_STRICT
});
tin.setPoints([
[[80, 90], [160, -90]],
[[120, 120], [240, -120]],
[[100, 140], [200, -140]],
[[130, 180], [260, -180]],
[[70, 150], [140, -150]]
]);
tin.updateTinAsync().then(() => {
const output = document.getElementById('output');
const result1 = tin.transform([140, 150]);
const result2 = tin.transform(result1, true);
output.innerHTML = `
<h2>Test Results:</h2>
<p>Forward transform [140, 150] => [${result1.join(', ')}]</p>
<p>Backward transform [${result1.join(', ')}] => [${result2.join(', ')}]</p>
`;
});
</script>
</body>
</html>