@maplat/tin 0.9.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ja.md ADDED
@@ -0,0 +1,121 @@
1
+ # Maplat Tin
2
+
3
+ 2つの平面座標系間で制御点に基づく同相変換を定義・実行するJavaScriptライブラリです。
4
+ [Maplat](https://github.com/code4history/Maplat/)プロジェクトの一部として開発されています。
5
+
6
+ English README is [here](./README.md).
7
+
8
+ ## 主な機能
9
+
10
+ - **座標変換定義の生成:** 制御点とエッジ制約に基づいて座標変換定義を生成
11
+ - **双方向座標変換:** 2つの平面間で双方向の座標変換が可能
12
+ - **位相保存:** 変換時の同相性(トポロジー)を維持
13
+ - **柔軟な設定:**
14
+ - 通常/鳥瞰図モードの頂点処理
15
+ - 厳密/自動/緩和モードのトポロジーチェック
16
+ - Y軸の向きの制御
17
+ - **エッジ制約:** より正確な変換のための制約付きエッジの指定が可能
18
+ - **状態管理:** 変換定義の保存と復元をサポート
19
+
20
+ ## インストール方法
21
+
22
+ ### npm
23
+
24
+ ```sh
25
+ # メインパッケージのインストール
26
+ npm install @maplat/tin
27
+
28
+ # 必要な依存パッケージのインストール
29
+ npm install delaunator
30
+ ```
31
+
32
+ ### ブラウザ
33
+
34
+ ```html
35
+ <!-- 必要な依存パッケージ -->
36
+ <script src="https://unpkg.com/delaunator/delaunator.min.js"></script>
37
+
38
+ <!-- Maplat Tin -->
39
+ <script src="https://unpkg.com/@maplat/tin/dist/maplat_tin.umd.js"></script>
40
+ ```
41
+
42
+ ## 基本的な使用方法
43
+
44
+ ```javascript
45
+ // 基本設定でインスタンスを作成
46
+ const tin = new Tin({
47
+ wh: [500, 500], // ソース座標系の幅と高さ
48
+ yaxisMode: Tin.YAXIS_FOLLOW // Y軸の向きの設定
49
+ });
50
+
51
+ // 制御点の設定: [ソース座標, ターゲット座標] の配列
52
+ tin.setPoints([
53
+ [[100,100], [200, 200]], // 点1
54
+ [[200,200], [400, 400]], // 点2
55
+ [[150,150], [320, 350]], // 点3
56
+ [[200,100], [420, 220]] // 点4
57
+ ]);
58
+
59
+ // TINネットワークの初期化
60
+ tin.updateTin();
61
+
62
+ // トポロジーの状態確認
63
+ if (tin.strict_status === Tin.STATUS_STRICT) {
64
+ console.log('トポロジーOK: 往復変換が保証されます');
65
+ } else if (tin.strict_status === Tin.STATUS_LOOSE) {
66
+ console.log('トポロジー警告: 往復変換が保証されません');
67
+ }
68
+
69
+ // 順方向の変換(ソース → ターゲット)
70
+ const transformed = tin.transform([160, 160], false);
71
+
72
+ // 逆方向の変換(ターゲット → ソース)
73
+ const restored = tin.transform(transformed, true);
74
+ ```
75
+
76
+ ## 設定オプション
77
+
78
+ ### コンストラクタオプション
79
+ | **オプション** | **型** | **説明** | **デフォルト** |
80
+ | ------------- | --------------------------- | ------------------------- | ------------- |
81
+ | `bounds` | `Position[]` | **境界多角形の頂点** | `-` |
82
+ | `wh` | `number[]` | **幅と高さ [w, h]** | `-` |
83
+ | `vertexMode` | `"plain"|"birdeye"` | **頂点処理モード** | `"plain"` |
84
+ | `strictMode` | `"strict"|"auto"|"loose"` | **トポロジーチェックモード** | `"auto"` |
85
+ | `yaxisMode` | `"follow"|"invert"` | **Y軸の向き** | `"invert"` |
86
+ | `importance` | `number` | **地図の重要度** | `0` |
87
+ | `priority` | `number` | **地図の優先度** | `0` |
88
+
89
+ `bounds`または`wh`のいずれかを指定する必要があります。
90
+
91
+ ### メソッド
92
+
93
+ | **メソッド** | **説明** |
94
+ | ---------------------------- | --------------------------------- |
95
+ | `setPoints(points)` | **制御点の設定** |
96
+ | `setEdges(edges)` | **制約付きエッジの設定** |
97
+ | `updateTin()` | **TINネットワークの初期化/更新** |
98
+ | `transform(coords, inverse)` | **座標変換の実行** |
99
+ | `getCompiled()` | **シリアライズ可能な状態の取得** |
100
+ | `setCompiled(state)` | **シリアライズされた状態からの復元** |
101
+
102
+ ### エラーハンドリング
103
+
104
+ このライブラリは以下の場合にエラーをスローします:
105
+
106
+ - `"TOO LINEAR1"`,`"TOO LINEAR2"`: 制御点が直線状に並びすぎている
107
+ - `"SOME POINTS OUTSIDE"`: 点が境界外にある
108
+ - 逆変換が許可されていない状態での逆変換実行時
109
+
110
+ ## ライセンス
111
+
112
+ Maplat Limited License 1.1
113
+
114
+ Copyright (c) 2024 Code for History
115
+
116
+ ## 開発者
117
+
118
+ - Kohei Otsuka
119
+ - Code for History
120
+
121
+ あなたの貢献をお待ちしています![イシューやプルリクエスト](https://github.com/code4history/MaplatTin/issues)は大歓迎です。
package/README.md CHANGED
@@ -1,111 +1,122 @@
1
- # Maplat Tin library
2
-
3
- JavaScript library which performs homeomorphic conversion mutually between the coordinate systems of two planes based on the control points.
4
- This is part of [Maplat](https://github.com/code4nara/Maplat/wiki) project.
5
-
6
- ## Installation
7
-
8
- ### node.js
9
-
10
- The easiest way to install maplat_tin is with [`npm`][npm].
11
-
12
- [npm]: https://www.npmjs.com/
13
-
14
- ```sh
15
- npm install @maplat/tin
16
- ```
17
-
18
- ### Browser
19
-
20
- Use [maplat_tin.js](https://code4history.github.io/MaplatTin/www/maplat_tin.js)
21
-
22
- ```html
23
- <script type="text/javascript" src="maplat_tin.js"></script>
24
- ```
25
-
26
-
27
- ## How to use (node.js case)
28
-
29
- ```javascript
30
- var Tin = require('maplat_tin');
31
-
32
- var tin = new Tin({
33
- wh: [500, 500],
34
- yaxisMode: Tin.YAXIS_FOLLOW
35
- });
36
-
37
- tin.setPoints([
38
- [[100,100], [200, 200]],
39
- [[200,200], [400, 400]],
40
- [[150,150], [320, 350]],
41
- [[200,100], [420, 220]]
42
- ]);
43
- tin.updateTinAsync().then(function() {
44
- if (tin.strict_status == Tin.STATUS_STRICT) {
45
- console.log('Topology OK: In this case, roundtrip transform is guaranteed');
46
- } else if (tin.strict_status == Tin.STATUS_LOOSE) {
47
- console.log('Topology error: In this case, roundtrip transform is not guaranteed');
48
- } else {
49
- console.log('Something wrong');
50
- }
51
-
52
- //Forward transform
53
- var ord = tin.transform([160, 160], false);
54
- console.log(ord);
55
- //ord => [336.0769755832048, 360.048109739503]
56
-
57
- //Backward transform
58
- var rev = tin.transform(ord, true);
59
- console.log(rev);
60
- //rev => [160, 160]
61
-
62
- //Solving triangulated irregular network from many points by scrach takes too many time.
63
- //So, there are object-serialization method to store solved instance.
64
-
65
- var compiled = tin.getCompiled();
66
-
67
- var tin2 = new Tin();
68
- tin2.setCompiled(compiled);
69
- // Compiled triangulated irregular network was set. no "updateTinAsync" call is need.
70
-
71
- var ord2 = tin.transform([160, 160], false);
72
- console.log(ord2);
73
- var rev2 = tin.transform(ord2, true);
74
- console.log(rev2);
75
- //Same results with ord, rev
76
- }).catch(function(e) {
77
- if (e == 'TOO LINEAR1' || e == 'TOO LINEAR2') {
78
- console.log('Given GCP points are too linear, fail to create triangulated irregular network.');
79
- } else {
80
- console.log('Something wrong');
81
- }
82
- });
83
- ```
84
-
85
- ## Options
86
-
87
- ### wh (method: setWh)
88
- Set width and height of the first coordinate system.
89
- *NOTE: If setWh was called, TIN network is reset. So need to call updateTinAsync() again.*
90
-
91
- ### yaxisMode
92
- Set *Tin.YAXIS_FOLLOW* if the y coordinate of the first coordinate system is the same as the direction of the y axis of the second coordinate system, and set *Tin.YAXIS_INVERT* if it is in the opposite direction.
93
- Default value is *Tin.YAXIS_INVERT*.
94
-
95
- ### points (method: setPoints)
96
- A set of corresponding points in the first coordinate system and the second coordinate system is specified as an array. Minimum 3 points required. Also, if the alignment of points is too linear, TIN can not be calculated at updateTinAsync and an error occurs.
97
- *NOTE: If setPoints was called, TIN network is reset. So need to call updateTinAsync() again.*
98
-
99
- ## Methods
100
-
101
- ### updateTinAsync()
102
- Return value is Promise. Calcurate TIN asynchronously. Before calling *transform*, this method needs to be completed.
103
-
104
- ### transform(xy, inverse)
105
- Convert the coordinates. If the value of *inverse* is false, the direction of conversion is from the first coordinate system to the second one, if it is true, the direction of conversion is reverse direction.
106
-
107
- ## Properties
108
-
109
- ### strict_status
110
-
111
- Confirm after completion of *updateTinAsync()*. When the value is *Tin.STATUS_STRICT*, bijection conversion is guaranteed. In the case of *Tin.STATUS_LOOSE* it is not guaranteed.
1
+ # Maplat Tin
2
+
3
+ A JavaScript library that defines and executes homeomorphic conversion between two plane coordinate systems based on control points.
4
+ This is part of the [Maplat](https://github.com/code4history/Maplat/) project.
5
+
6
+ 日本語のREADMEは[こちら](./README.ja.md)
7
+
8
+ ## Key Features
9
+
10
+ - **Generate Transformation Definitions:** Create coordinate transformation definitions based on control points and edge constraints
11
+ - **Bidirectional Coordinate Transformation:** Convert coordinates between two planes in both directions
12
+ - **Topology Preservation:** Maintains homeomorphic properties during transformation
13
+ - **Flexible Configuration:**
14
+ - Vertex handling modes (normal/bird's-eye view)
15
+ - Topology check modes (strict/auto/loose)
16
+ - Y-axis direction control
17
+ - **Edge Constraints:** Ability to specify constrained edges for more accurate transformation
18
+ - **State Management:** Save and restore transformation definitions
19
+
20
+ ## Installation
21
+
22
+ ### npm
23
+
24
+ ```sh
25
+ # Install the main package
26
+ npm install @maplat/tin
27
+
28
+ # Install required dependency
29
+ npm install delaunator
30
+ ```
31
+
32
+ ### Browser
33
+
34
+ ```html
35
+ <!-- Required dependency -->
36
+ <script src="https://unpkg.com/delaunator/delaunator.min.js"></script>
37
+
38
+ <!-- Maplat Tin -->
39
+ <script src="https://unpkg.com/@maplat/tin/dist/maplat_tin.umd.js"></script>
40
+ ```
41
+
42
+ ## Basic Usage
43
+
44
+ ```javascript
45
+ // Create a new instance with basic configuration
46
+ const tin = new Tin({
47
+ wh: [500, 500], // Width and height of the source plane
48
+ yaxisMode: Tin.YAXIS_FOLLOW // Y-axis direction handling
49
+ });
50
+
51
+ // Set control points: Array of [source, target] coordinates
52
+ tin.setPoints([
53
+ [[100,100], [200, 200]], // Point 1
54
+ [[200,200], [400, 400]], // Point 2
55
+ [[150,150], [320, 350]], // Point 3
56
+ [[200,100], [420, 220]] // Point 4
57
+ ]);
58
+
59
+ // Initialize the TIN network
60
+ tin.updateTin();
61
+
62
+ // Check topology status
63
+ if (tin.strict_status === Tin.STATUS_STRICT) {
64
+ console.log('Topology OK: Roundtrip transform is guaranteed');
65
+ } else if (tin.strict_status === Tin.STATUS_LOOSE) {
66
+ console.log('Topology warning: Roundtrip transform is not guaranteed');
67
+ }
68
+
69
+ // Forward transform: source to target
70
+ const transformed = tin.transform([160, 160], false);
71
+
72
+ // Backward transform: target to source
73
+ const restored = tin.transform(transformed, true);
74
+ ```
75
+
76
+ ## Configuration
77
+
78
+ ### Constructor Options
79
+
80
+ | **Option** | **Type** | **Description** | **Default** |
81
+ | ------------- | --------------------------- | ------------------------- | ------------- |
82
+ | `bounds` | `Position[]` | **Boundary polygon vertices** | `-` |
83
+ | `wh` | `number[]` | **Width and height [w, h]** | `-` |
84
+ | `vertexMode` | `"plain"|"birdeye"` | **Vertex handling mode** | `"plain"` |
85
+ | `strictMode` | `"strict"|"auto"|"loose"` | **Topology check mode** | `"auto"` |
86
+ | `yaxisMode` | `"follow"|"invert"` | **Y-axis direction** | `"invert"` |
87
+ | `importance` | `number` | **Map importance** | `0` |
88
+ | `priority` | `number` | **Map priority** | `0` |
89
+
90
+ Either `bounds` or `wh` must be specified.
91
+
92
+ ### Methods
93
+
94
+ | **Method** | **Description** |
95
+ | ---------------------------- | --------------------------------- |
96
+ | `setPoints(points)` | **Set control points** |
97
+ | `setEdges(edges)` | **Set constrained edges** |
98
+ | `updateTin()` | **Initialize/update TIN network** |
99
+ | `transform(coords, inverse)` | **Execute coordinate transformation** |
100
+ | `getCompiled()` | **Get serializable state** |
101
+ | `setCompiled(state)` | **Restore from serialized state** |
102
+
103
+ ### Error Handling
104
+
105
+ The library may throw errors in the following cases:
106
+
107
+ - `"TOO LINEAR1"`,`"TOO LINEAR2"`: Control points are too linear
108
+ - `"SOME POINTS OUTSIDE"`: Points outside boundary
109
+ - Custom error when attempting backward transformation in a disallowed state
110
+
111
+ ## License
112
+
113
+ Maplat Limited License 1.1
114
+
115
+ Copyright (c) 2024 Code for History
116
+
117
+ ## Developers
118
+
119
+ - Kohei Otsuka
120
+ - Code for History
121
+
122
+ We welcome your contributions! Feel free to submit [issues and pull requests](https://github.com/code4history/MaplatTin/issues).
@@ -0,0 +1,196 @@
1
+ import { Compiled } from '@maplat/transform';
2
+ import { Edge } from '@maplat/transform';
3
+ import { EdgeSet } from '@maplat/transform';
4
+ import { EdgeSetLegacy } from '@maplat/transform';
5
+ import { FeatureCollection } from 'geojson';
6
+ import { GeoJsonProperties } from 'geojson';
7
+ import { Geometry } from 'geojson';
8
+ import { PointSet } from '@maplat/transform';
9
+ import { Position } from 'geojson';
10
+ import { StrictMode } from '@maplat/transform';
11
+ import { Transform } from '@maplat/transform';
12
+ import { VertexMode } from '@maplat/transform';
13
+ import { YaxisMode } from '@maplat/transform';
14
+
15
+ /**
16
+ * Tinクラスの初期化オプション
17
+ *
18
+ * @property {Position[]} bounds - 境界ポリゴンを定義する頂点配列
19
+ * @property {number[]} wh - 幅と高さ [width, height]
20
+ * @property {VertexMode} vertexMode - 頂点モード ("plain" | "birdeye")
21
+ * @property {StrictMode} strictMode - 厳密性モード ("strict" | "auto" | "loose")
22
+ * @property {YaxisMode} yaxisMode - Y軸の向き ("follow" | "invert")
23
+ * @property {number} importance - 重要度
24
+ * @property {number} priority - 優先度
25
+ * @property {boolean} stateFull - 状態を保持するかどうか
26
+ * @property {PointSet[]} points - 制御点の配列
27
+ * @property {EdgeSet[]} edges - エッジ(制約線)の配列
28
+ */
29
+ export declare interface Options {
30
+ bounds: Position[];
31
+ wh: number[];
32
+ vertexMode: VertexMode;
33
+ strictMode: StrictMode;
34
+ yaxisMode: YaxisMode;
35
+ importance: number;
36
+ priority: number;
37
+ stateFull: boolean;
38
+ points: PointSet[];
39
+ edges: EdgeSet[];
40
+ }
41
+
42
+ /**
43
+ * Tin (Triangulated Irregular Network) クラス
44
+ * 2つの平面座標系間の同相変換を実現します。
45
+ *
46
+ * @property {number} importance - マップの重要度
47
+ * @property {number} priority - マップの優先度
48
+ * @property {any} pointsSet - 変換用の点群セット
49
+ */
50
+ declare class Tin extends Transform {
51
+ importance: number;
52
+ priority: number;
53
+ pointsSet: any;
54
+ /**
55
+ * Tinクラスのインスタンスを生成します
56
+ *
57
+ * @param {Partial<Options>} options - 初期化オプション
58
+ * bounds または wh のどちらかが必須です
59
+ */
60
+ constructor(options?: Partial<Options>);
61
+ /**
62
+ * フォーマットバージョンを取得します
63
+ *
64
+ * @returns {number} 現在のフォーマットバージョン
65
+ */
66
+ getFormatVersion(): number;
67
+ /**
68
+ * 制御点(GCP: Ground Control Points)を設定します
69
+ *
70
+ * @param points - 制御点の配列。各要素は [ソース座標, ターゲット座標] の形式
71
+ *
72
+ * 注意:この操作によりTINネットワークはリセットされ、
73
+ * 再度updateTin()を呼び出す必要があります。
74
+ */
75
+ setPoints(points: PointSet[]): void;
76
+ /**
77
+ * エッジ(制約線)を設定します
78
+ *
79
+ * @param edges - エッジの配列。新規フォーマットまたはレガシーフォーマットに対応
80
+ *
81
+ * 注意:この操作によりTINネットワークはリセットされ、
82
+ * 再度updateTin()を呼び出す必要があります。
83
+ */
84
+ setEdges(edges?: EdgeSet[] | EdgeSetLegacy[]): void;
85
+ /**
86
+ * 境界ポリゴンを設定します
87
+ *
88
+ * @param bounds - 境界を定義する頂点座標の配列
89
+ *
90
+ * - 境界ポリゴンの計算
91
+ * - バウンディングボックスの計算
92
+ * - 内部状態の更新
93
+ */
94
+ setBounds(bounds: number[][]): void;
95
+ /**
96
+ * 現在の設定を永続化可能な形式にコンパイルします
97
+ *
98
+ * @returns Compiled - コンパイルされた設定オブジェクト
99
+ *
100
+ * 以下の情報が含まれます:
101
+ * - バージョン情報
102
+ * - 制御点データ
103
+ * - TINネットワーク情報
104
+ * - 境界情報
105
+ * - 各種モード設定
106
+ */
107
+ getCompiled(): Compiled;
108
+ /**
109
+ * 幅と高さを設定します
110
+ *
111
+ * @param {number[]} wh - [width, height] の形式で指定
112
+ * この操作によりTINネットワークはリセットされます
113
+ */
114
+ setWh(wh: number[]): void;
115
+ /**
116
+ * 頂点モードを設定します
117
+ *
118
+ * @param {VertexMode} mode - "plain" または "birdeye"
119
+ * この操作によりTINネットワークはリセットされます
120
+ */
121
+ setVertexMode(mode: VertexMode): void;
122
+ /**
123
+ * 厳密性モードを設定します
124
+ *
125
+ * @param {StrictMode} mode - "strict", "auto", または "loose"
126
+ * この操作によりTINネットワークはリセットされます
127
+ */
128
+ setStrictMode(mode: StrictMode): void;
129
+ /**
130
+ * 厳密なTINを計算します
131
+ *
132
+ * - 逆方向の三角形を生成
133
+ * - 交差チェックを実行
134
+ * - 結果に基づいてstrict_statusを更新
135
+ *
136
+ * strict_statusは以下のいずれかになります:
137
+ * - STATUS_STRICT: 交差なし
138
+ * - STATUS_ERROR: 交差あり
139
+ */
140
+ calcurateStrictTin(): void;
141
+ /**
142
+ * 点群セットを生成します
143
+ *
144
+ * 以下の処理を行います:
145
+ * 1. 制御点からポイントセットを生成
146
+ * 2. エッジ節点の生成と追加
147
+ * 3. エッジの接続関係の構築
148
+ *
149
+ * @returns {object} 生成された点群セットと接続情報
150
+ * @property {FeatureCollection} forw - 順方向の点群
151
+ * @property {FeatureCollection} bakw - 逆方向の点群
152
+ * @property {Array} edges - エッジ接続情報
153
+ */
154
+ generatePointsSet(): {
155
+ forw: FeatureCollection<Geometry, GeoJsonProperties>;
156
+ bakw: FeatureCollection<Geometry, GeoJsonProperties>;
157
+ edges: Edge[];
158
+ };
159
+ /**
160
+ * 入力データの検証と初期データの準備
161
+ * - 境界値のチェック
162
+ * - バッファー付き境界の計算
163
+ * - 点群セットの生成
164
+ * @returns {object} 検証済みの点群セットと境界データ
165
+ * @throws {Error} "SOME POINTS OUTSIDE" 制御点が境界外にある場合
166
+ */
167
+ private validateAndPrepareInputs;
168
+ /**
169
+ * TINネットワークを更新し、座標変換の準備を行います
170
+ *
171
+ * このメソッドは以下の処理を実行します:
172
+ * 1. 入力データの検証
173
+ * 2. 制御点のTIN生成
174
+ * 3. Convex Hull(凸包)の計算
175
+ * 4. 境界の調整
176
+ * 5. 変換パラメータの計算
177
+ *
178
+ * @throws {Error} "TOO LINEAR1" - 制御点が直線的すぎる場合
179
+ * @throws {Error} "TOO LINEAR2" - 変換後の点が直線的すぎる場合
180
+ * @throws {Error} "SOME POINTS OUTSIDE" - 制御点が境界外にある場合
181
+ */
182
+ updateTin(): void;
183
+ /**
184
+ * 点の重み付けを計算します
185
+ *
186
+ * - 各点について周辺の三角形から重みを計算
187
+ * - 順方向と逆方向(必要な場合)の重みを計算
188
+ * - 重心点の重みも計算
189
+ *
190
+ * 重みは変換の精度と安定性に影響を与えます
191
+ */
192
+ calculatePointsWeight(): void;
193
+ }
194
+ export default Tin;
195
+
196
+ export { }
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ja">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>MaplatTin Test</title>
6
+ <script src="https://unpkg.com/@turf/turf/turf.min.js"></script>
7
+ <script src="https://unpkg.com/delaunator/delaunator.min.js"></script>
8
+ <script src="https://unpkg.com/@kninnug/constrainautor/lib/Constrainautor.min.js"></script>
9
+ </head>
10
+ <body>
11
+ <h1>MaplatTin Test</h1>
12
+ <div id="output"></div>
13
+ <script type="module">
14
+ import Tin from '/src/index.ts';
15
+
16
+ const tin = new Tin({
17
+ bounds: [[100, 50], [150, 150], [150, 200], [60, 190], [50, 100]],
18
+ strictMode: Tin.MODE_STRICT
19
+ });
20
+
21
+ tin.setPoints([
22
+ [[80, 90], [160, -90]],
23
+ [[120, 120], [240, -120]],
24
+ [[100, 140], [200, -140]],
25
+ [[130, 180], [260, -180]],
26
+ [[70, 150], [140, -150]]
27
+ ]);
28
+
29
+ tin.updateTinAsync().then(() => {
30
+ const output = document.getElementById('output');
31
+ const result1 = tin.transform([140, 150]);
32
+ const result2 = tin.transform(result1, true);
33
+
34
+ output.innerHTML = `
35
+ <h2>Test Results:</h2>
36
+ <p>Forward transform [140, 150] => [${result1.join(', ')}]</p>
37
+ <p>Backward transform [${result1.join(', ')}] => [${result2.join(', ')}]</p>
38
+ `;
39
+ });
40
+ </script>
41
+ </body>
42
+ </html>