@maplat/tin 0.11.1 → 0.11.2
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 +44 -1
- package/README.md +44 -1
- package/dist/index.d.ts +4 -4
- package/dist/kinks.d.ts +1 -1
- package/dist/searchutils.d.ts +1 -1
- package/dist/tin.cjs +2 -2
- package/dist/tin.d.ts +1 -1
- package/dist/tin.js +317 -213
- package/dist/tin.umd.js +2 -2
- package/dist/vertexutils.d.ts +1 -1
- package/package.json +6 -4
- package/src/constrained-tin.ts +18 -13
- package/src/index.ts +14 -14
- package/src/kinks.ts +39 -35
- package/src/searchutils.ts +16 -15
- package/src/tin.ts +375 -242
- package/src/types/constrainautor.d.ts +2 -2
- package/src/types/kinks.d.ts +19 -6
- package/src/types/tin.d.ts +2 -2
- package/src/vertexutils.ts +23 -18
package/src/types/kinks.d.ts
CHANGED
|
@@ -3,9 +3,18 @@ export interface IntersectionPoint {
|
|
|
3
3
|
y: number;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export type ArcCallback = (
|
|
7
|
+
i: number,
|
|
8
|
+
j: number,
|
|
9
|
+
xx: Float64Array,
|
|
10
|
+
yy: Float64Array,
|
|
11
|
+
) => void;
|
|
12
|
+
export type ForEachSegmentCallback = (
|
|
13
|
+
v1: number,
|
|
14
|
+
v2: number,
|
|
15
|
+
xx: Float64Array,
|
|
16
|
+
yy: Float64Array,
|
|
17
|
+
) => void;
|
|
9
18
|
|
|
10
19
|
export interface Arc {
|
|
11
20
|
i: number;
|
|
@@ -24,8 +33,12 @@ export class ArcIter {
|
|
|
24
33
|
x: number;
|
|
25
34
|
y: number;
|
|
26
35
|
z: number;
|
|
27
|
-
|
|
28
|
-
constructor(
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
xx: Float64Array | null,
|
|
39
|
+
yy: Float64Array | null,
|
|
40
|
+
zz?: Float64Array | null,
|
|
41
|
+
);
|
|
29
42
|
init(i: number, len: number, fw: boolean, zlim?: number): ArcIter;
|
|
30
43
|
hasNext(): boolean;
|
|
31
44
|
next(): void;
|
|
@@ -33,4 +46,4 @@ export class ArcIter {
|
|
|
33
46
|
|
|
34
47
|
export class FilteredArcIter extends ArcIter {
|
|
35
48
|
constructor();
|
|
36
|
-
}
|
|
49
|
+
}
|
package/src/types/tin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FeatureCollection, Point, Polygon, Position } from "geojson";
|
|
2
2
|
|
|
3
3
|
export interface PointsSetBD {
|
|
4
4
|
forw: FeatureCollection<Point>;
|
|
@@ -51,4 +51,4 @@ export interface ExpandConvexItem {
|
|
|
51
51
|
bakw: Position;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export type ExpandConvexArray = ExpandConvexItem[][];
|
|
54
|
+
export type ExpandConvexArray = ExpandConvexItem[][];
|
package/src/vertexutils.ts
CHANGED
|
@@ -10,7 +10,11 @@ import type { Tins } from "@maplat/transform";
|
|
|
10
10
|
* @param index インデックス
|
|
11
11
|
* @returns 生成された点オブジェクト
|
|
12
12
|
*/
|
|
13
|
-
function createPoint(
|
|
13
|
+
function createPoint(
|
|
14
|
+
xy: Position,
|
|
15
|
+
geom: Position,
|
|
16
|
+
index: string | number,
|
|
17
|
+
): Feature<Point> {
|
|
14
18
|
return point(xy, { target: { geom, index } });
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -23,8 +27,8 @@ function counterPoint(apoint: Feature<Point>): Feature<Point> {
|
|
|
23
27
|
return point(apoint.properties!.target.geom, {
|
|
24
28
|
target: {
|
|
25
29
|
geom: apoint.geometry!.coordinates,
|
|
26
|
-
index: apoint.properties!.target.index
|
|
27
|
-
}
|
|
30
|
+
index: apoint.properties!.target.index,
|
|
31
|
+
},
|
|
28
32
|
});
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -34,36 +38,41 @@ function counterPoint(apoint: Feature<Point>): Feature<Point> {
|
|
|
34
38
|
* @param centroid 重心点
|
|
35
39
|
* @returns [角度リスト, 三角形リスト]
|
|
36
40
|
*/
|
|
37
|
-
function vertexCalc(
|
|
41
|
+
function vertexCalc(
|
|
42
|
+
list: Feature<Point>[],
|
|
43
|
+
centroid: Feature<Point>,
|
|
44
|
+
): [number[], Tins[]?] {
|
|
38
45
|
const centCoord = centroid.geometry!.coordinates;
|
|
39
46
|
return [0, 1, 2, 3]
|
|
40
|
-
.map(i => {
|
|
47
|
+
.map((i) => {
|
|
41
48
|
const j = (i + 1) % 4;
|
|
42
49
|
const itemi = list[i];
|
|
43
50
|
const itemj = list[j];
|
|
44
51
|
const coord = itemi.geometry!.coordinates;
|
|
45
52
|
const radian = Math.atan2(
|
|
46
53
|
coord[0] - centCoord[0],
|
|
47
|
-
coord[1] - centCoord[1]
|
|
54
|
+
coord[1] - centCoord[1],
|
|
48
55
|
);
|
|
49
56
|
const coordinates = [centroid, itemi, itemj, centroid].map(
|
|
50
|
-
point => point.geometry!.coordinates
|
|
57
|
+
(point) => point.geometry!.coordinates,
|
|
51
58
|
);
|
|
52
59
|
const properties = {
|
|
53
60
|
a: {
|
|
54
61
|
geom: centroid.properties!.target.geom,
|
|
55
|
-
index: centroid.properties!.target.index
|
|
62
|
+
index: centroid.properties!.target.index,
|
|
56
63
|
},
|
|
57
64
|
b: {
|
|
58
65
|
geom: itemi.properties!.target.geom,
|
|
59
|
-
index: itemi.properties!.target.index
|
|
66
|
+
index: itemi.properties!.target.index,
|
|
60
67
|
},
|
|
61
68
|
c: {
|
|
62
69
|
geom: itemj.properties!.target.geom,
|
|
63
|
-
index: itemj.properties!.target.index
|
|
64
|
-
}
|
|
70
|
+
index: itemj.properties!.target.index,
|
|
71
|
+
},
|
|
65
72
|
};
|
|
66
|
-
const tin = featureCollection([
|
|
73
|
+
const tin = featureCollection([
|
|
74
|
+
polygon([coordinates], properties),
|
|
75
|
+
]) as Tins;
|
|
67
76
|
return [radian, tin] as [number, Tins];
|
|
68
77
|
})
|
|
69
78
|
.reduce(
|
|
@@ -72,12 +81,8 @@ function vertexCalc(list: Feature<Point>[], centroid: Feature<Point>): [number[]
|
|
|
72
81
|
prev[1].push(curr[1]);
|
|
73
82
|
return prev;
|
|
74
83
|
},
|
|
75
|
-
[[] as number[], [] as Tins[]]
|
|
84
|
+
[[] as number[], [] as Tins[]],
|
|
76
85
|
);
|
|
77
86
|
}
|
|
78
87
|
|
|
79
|
-
export {
|
|
80
|
-
createPoint,
|
|
81
|
-
counterPoint,
|
|
82
|
-
vertexCalc
|
|
83
|
-
};
|
|
88
|
+
export { counterPoint, createPoint, vertexCalc };
|