@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.
@@ -1,6 +1,6 @@
1
- declare module '@kninnug/constrainautor' {
1
+ declare module "@kninnug/constrainautor" {
2
2
  export default class Constrainautor {
3
3
  constructor(delaunay: any);
4
4
  constrainAll(edges: [number, number][]): void;
5
5
  }
6
- }
6
+ }
@@ -3,9 +3,18 @@ export interface IntersectionPoint {
3
3
  y: number;
4
4
  }
5
5
 
6
-
7
- export type ArcCallback = (i: number, j: number, xx: Float64Array, yy: Float64Array) => void;
8
- export type ForEachSegmentCallback = (v1: number, v2: number, xx: Float64Array, yy: Float64Array) => void;
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(xx: Float64Array | null, yy: Float64Array | null, zz?: Float64Array | null);
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
+ }
@@ -1,4 +1,4 @@
1
- import type { Point, Position, FeatureCollection, Polygon } from "geojson";
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[][];
@@ -10,7 +10,11 @@ import type { Tins } from "@maplat/transform";
10
10
  * @param index インデックス
11
11
  * @returns 生成された点オブジェクト
12
12
  */
13
- function createPoint(xy: Position, geom: Position, index: string | number): Feature<Point> {
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(list: Feature<Point>[], centroid: Feature<Point>): [number[], Tins[]?] {
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([polygon([coordinates], properties)]) as Tins;
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 };