@maplibre/mlt 0.0.1-alpha.9 → 1.0.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.
Files changed (253) hide show
  1. package/dist/{encodings → decoding}/decodingUtils.js +18 -33
  2. package/dist/decoding/decodingUtils.js.map +1 -0
  3. package/dist/decoding/decodingUtils.spec.d.ts +1 -0
  4. package/dist/decoding/decodingUtils.spec.js +125 -0
  5. package/dist/decoding/decodingUtils.spec.js.map +1 -0
  6. package/dist/{encodings → decoding}/fsstDecoder.js +1 -4
  7. package/dist/decoding/fsstDecoder.js.map +1 -0
  8. package/dist/decoding/fsstDecoder.spec.d.ts +1 -0
  9. package/dist/decoding/fsstDecoder.spec.js +36 -0
  10. package/dist/decoding/fsstDecoder.spec.js.map +1 -0
  11. package/dist/{encodings → decoding}/geometryDecoder.js +65 -71
  12. package/dist/decoding/geometryDecoder.js.map +1 -0
  13. package/dist/decoding/geometryDecoder.spec.d.ts +1 -0
  14. package/dist/decoding/geometryDecoder.spec.js +5 -0
  15. package/dist/decoding/geometryDecoder.spec.js.map +1 -0
  16. package/dist/decoding/geometryScaling.js +2 -0
  17. package/dist/decoding/geometryScaling.js.map +1 -0
  18. package/dist/{encodings → decoding}/intWrapper.js +2 -4
  19. package/dist/decoding/intWrapper.js.map +1 -0
  20. package/dist/{encodings → decoding}/integerDecodingUtils.d.ts +13 -0
  21. package/dist/{encodings → decoding}/integerDecodingUtils.js +89 -88
  22. package/dist/decoding/integerDecodingUtils.js.map +1 -0
  23. package/dist/decoding/integerDecodingUtils.spec.d.ts +1 -0
  24. package/dist/decoding/integerDecodingUtils.spec.js +194 -0
  25. package/dist/decoding/integerDecodingUtils.spec.js.map +1 -0
  26. package/dist/{encodings → decoding}/integerStreamDecoder.d.ts +1 -1
  27. package/dist/decoding/integerStreamDecoder.js +263 -0
  28. package/dist/decoding/integerStreamDecoder.js.map +1 -0
  29. package/dist/decoding/integerStreamDecoder.spec.d.ts +1 -0
  30. package/dist/decoding/integerStreamDecoder.spec.js +125 -0
  31. package/dist/decoding/integerStreamDecoder.spec.js.map +1 -0
  32. package/dist/{encodings → decoding}/propertyDecoder.d.ts +1 -1
  33. package/dist/decoding/propertyDecoder.js +140 -0
  34. package/dist/decoding/propertyDecoder.js.map +1 -0
  35. package/dist/decoding/propertyDecoder.spec.d.ts +1 -0
  36. package/dist/decoding/propertyDecoder.spec.js +682 -0
  37. package/dist/decoding/propertyDecoder.spec.js.map +1 -0
  38. package/dist/{encodings → decoding}/stringDecoder.d.ts +1 -1
  39. package/dist/decoding/stringDecoder.js +142 -0
  40. package/dist/decoding/stringDecoder.js.map +1 -0
  41. package/dist/decoding/stringDecoder.spec.d.ts +1 -0
  42. package/dist/decoding/stringDecoder.spec.js +311 -0
  43. package/dist/decoding/stringDecoder.spec.js.map +1 -0
  44. package/dist/index.d.ts +2 -4
  45. package/dist/index.js +5 -20
  46. package/dist/index.js.map +1 -1
  47. package/dist/metadata/tile/dictionaryType.js +2 -5
  48. package/dist/metadata/tile/dictionaryType.js.map +1 -1
  49. package/dist/metadata/tile/lengthType.js +2 -5
  50. package/dist/metadata/tile/lengthType.js.map +1 -1
  51. package/dist/metadata/tile/logicalLevelTechnique.js +2 -5
  52. package/dist/metadata/tile/logicalLevelTechnique.js.map +1 -1
  53. package/dist/metadata/tile/logicalStreamType.js +4 -5
  54. package/dist/metadata/tile/logicalStreamType.js.map +1 -1
  55. package/dist/metadata/tile/mortonEncodedStreamMetadata.d.ts +1 -1
  56. package/dist/metadata/tile/mortonEncodedStreamMetadata.js +8 -10
  57. package/dist/metadata/tile/mortonEncodedStreamMetadata.js.map +1 -1
  58. package/dist/metadata/tile/offsetType.js +2 -5
  59. package/dist/metadata/tile/offsetType.js.map +1 -1
  60. package/dist/metadata/tile/physicalLevelTechnique.js +2 -5
  61. package/dist/metadata/tile/physicalLevelTechnique.js.map +1 -1
  62. package/dist/metadata/tile/physicalStreamType.js +2 -5
  63. package/dist/metadata/tile/physicalStreamType.js.map +1 -1
  64. package/dist/metadata/tile/rleEncodedStreamMetadata.d.ts +5 -1
  65. package/dist/metadata/tile/rleEncodedStreamMetadata.js +14 -10
  66. package/dist/metadata/tile/rleEncodedStreamMetadata.js.map +1 -1
  67. package/dist/metadata/tile/scalarType.js +2 -5
  68. package/dist/metadata/tile/scalarType.js.map +1 -1
  69. package/dist/metadata/tile/streamMetadata.d.ts +7 -1
  70. package/dist/metadata/tile/streamMetadata.js +35 -24
  71. package/dist/metadata/tile/streamMetadata.js.map +1 -1
  72. package/dist/metadata/tile/streamMetadataDecoder.d.ts +1 -1
  73. package/dist/metadata/tile/streamMetadataDecoder.js +13 -17
  74. package/dist/metadata/tile/streamMetadataDecoder.js.map +1 -1
  75. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.d.ts +2 -2
  76. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.js +40 -32
  77. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.js.map +1 -1
  78. package/dist/metadata/tileset/tilesetMetadata.d.ts +80 -0
  79. package/dist/metadata/tileset/tilesetMetadata.js +29 -0
  80. package/dist/metadata/tileset/tilesetMetadata.js.map +1 -0
  81. package/dist/metadata/tileset/typeMap.d.ts +1 -1
  82. package/dist/metadata/tileset/typeMap.js +63 -59
  83. package/dist/metadata/tileset/typeMap.js.map +1 -1
  84. package/dist/mltDecoder.d.ts +1 -1
  85. package/dist/mltDecoder.js +58 -64
  86. package/dist/mltDecoder.js.map +1 -1
  87. package/dist/mltDecoder.spec.d.ts +1 -0
  88. package/dist/mltDecoder.spec.js +152 -0
  89. package/dist/mltDecoder.spec.js.map +1 -0
  90. package/dist/mltMetadata.js +4 -7
  91. package/dist/mltMetadata.js.map +1 -1
  92. package/dist/vector/constant/intConstVector.d.ts +0 -13
  93. package/dist/vector/constant/intConstVector.js +2 -82
  94. package/dist/vector/constant/intConstVector.js.map +1 -1
  95. package/dist/vector/constant/longConstVector.d.ts +0 -13
  96. package/dist/vector/constant/longConstVector.js +2 -80
  97. package/dist/vector/constant/longConstVector.js.map +1 -1
  98. package/dist/vector/dictionary/stringDictionaryVector.d.ts +0 -14
  99. package/dist/vector/dictionary/stringDictionaryVector.js +6 -178
  100. package/dist/vector/dictionary/stringDictionaryVector.js.map +1 -1
  101. package/dist/vector/featureTable.d.ts +7 -2
  102. package/dist/vector/featureTable.js +45 -11
  103. package/dist/vector/featureTable.js.map +1 -1
  104. package/dist/vector/fixedSizeVector.js +2 -9
  105. package/dist/vector/fixedSizeVector.js.map +1 -1
  106. package/dist/vector/flat/bitVector.js +3 -4
  107. package/dist/vector/flat/bitVector.js.map +1 -1
  108. package/dist/vector/flat/booleanFlatVector.d.ts +0 -13
  109. package/dist/vector/flat/booleanFlatVector.js +3 -45
  110. package/dist/vector/flat/booleanFlatVector.js.map +1 -1
  111. package/dist/vector/flat/doubleFlatVector.d.ts +0 -13
  112. package/dist/vector/flat/doubleFlatVector.js +2 -104
  113. package/dist/vector/flat/doubleFlatVector.js.map +1 -1
  114. package/dist/vector/flat/floatFlatVector.d.ts +0 -13
  115. package/dist/vector/flat/floatFlatVector.js +2 -104
  116. package/dist/vector/flat/floatFlatVector.js.map +1 -1
  117. package/dist/vector/flat/floatFlatVector.spec.d.ts +1 -0
  118. package/dist/vector/flat/floatFlatVector.spec.js +14 -0
  119. package/dist/vector/flat/floatFlatVector.spec.js.map +1 -0
  120. package/dist/vector/flat/intFlatVector.d.ts +0 -13
  121. package/dist/vector/flat/intFlatVector.js +2 -117
  122. package/dist/vector/flat/intFlatVector.js.map +1 -1
  123. package/dist/vector/flat/intFlatVector.spec.d.ts +1 -0
  124. package/dist/vector/flat/intFlatVector.spec.js +15 -0
  125. package/dist/vector/flat/intFlatVector.spec.js.map +1 -0
  126. package/dist/vector/flat/longFlatVector.d.ts +0 -13
  127. package/dist/vector/flat/longFlatVector.js +2 -118
  128. package/dist/vector/flat/longFlatVector.js.map +1 -1
  129. package/dist/vector/flat/longFlatVector.spec.d.ts +1 -0
  130. package/dist/vector/flat/longFlatVector.spec.js +14 -0
  131. package/dist/vector/flat/longFlatVector.spec.js.map +1 -0
  132. package/dist/vector/flat/stringFlatVector.d.ts +0 -13
  133. package/dist/vector/flat/stringFlatVector.js +5 -166
  134. package/dist/vector/flat/stringFlatVector.js.map +1 -1
  135. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.d.ts +0 -13
  136. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.js +14 -51
  137. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.js.map +1 -1
  138. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.d.ts +1 -0
  139. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.js +28 -0
  140. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.js.map +1 -0
  141. package/dist/vector/geometry/constGeometryVector.d.ts +0 -4
  142. package/dist/vector/geometry/constGeometryVector.js +9 -30
  143. package/dist/vector/geometry/constGeometryVector.js.map +1 -1
  144. package/dist/vector/geometry/constGpuVector.d.ts +0 -4
  145. package/dist/vector/geometry/constGpuVector.js +4 -25
  146. package/dist/vector/geometry/constGpuVector.js.map +1 -1
  147. package/dist/vector/geometry/flatGeometryVector.d.ts +0 -4
  148. package/dist/vector/geometry/flatGeometryVector.js +8 -35
  149. package/dist/vector/geometry/flatGeometryVector.js.map +1 -1
  150. package/dist/vector/geometry/flatGpuVector.d.ts +0 -4
  151. package/dist/vector/geometry/flatGpuVector.js +3 -29
  152. package/dist/vector/geometry/flatGpuVector.js.map +1 -1
  153. package/dist/vector/geometry/geometryType.js +4 -7
  154. package/dist/vector/geometry/geometryType.js.map +1 -1
  155. package/dist/vector/geometry/geometryVector.d.ts +2 -5
  156. package/dist/vector/geometry/geometryVector.js +11 -13
  157. package/dist/vector/geometry/geometryVector.js.map +1 -1
  158. package/dist/vector/geometry/geometryVectorConverter.js +28 -34
  159. package/dist/vector/geometry/geometryVectorConverter.js.map +1 -1
  160. package/dist/vector/geometry/gpuVector.d.ts +5 -4
  161. package/dist/vector/geometry/gpuVector.js +89 -5
  162. package/dist/vector/geometry/gpuVector.js.map +1 -1
  163. package/dist/vector/geometry/spaceFillingCurve.js +6 -4
  164. package/dist/vector/geometry/spaceFillingCurve.js.map +1 -1
  165. package/dist/vector/geometry/topologyVector.js +4 -4
  166. package/dist/vector/geometry/topologyVector.js.map +1 -1
  167. package/dist/vector/geometry/vertexBufferType.js +2 -5
  168. package/dist/vector/geometry/vertexBufferType.js.map +1 -1
  169. package/dist/vector/geometry/zOrderCurve.js +2 -8
  170. package/dist/vector/geometry/zOrderCurve.js.map +1 -1
  171. package/dist/vector/geometry/zOrderCurve.spec.d.ts +1 -0
  172. package/dist/vector/geometry/zOrderCurve.spec.js +14 -0
  173. package/dist/vector/geometry/zOrderCurve.spec.js.map +1 -0
  174. package/dist/vector/intVector.js +1 -2
  175. package/dist/vector/sequence/intSequenceVector.d.ts +0 -13
  176. package/dist/vector/sequence/intSequenceVector.js +2 -64
  177. package/dist/vector/sequence/intSequenceVector.js.map +1 -1
  178. package/dist/vector/sequence/longSequenceVector.d.ts +0 -13
  179. package/dist/vector/sequence/longSequenceVector.js +2 -49
  180. package/dist/vector/sequence/longSequenceVector.js.map +1 -1
  181. package/dist/vector/sequence/longSequenceVektor.spec.d.ts +1 -0
  182. package/dist/vector/sequence/longSequenceVektor.spec.js +11 -0
  183. package/dist/vector/sequence/longSequenceVektor.spec.js.map +1 -0
  184. package/dist/vector/sequence/sequenceVector.js +3 -9
  185. package/dist/vector/sequence/sequenceVector.js.map +1 -1
  186. package/dist/vector/variableSizeVector.js +3 -9
  187. package/dist/vector/variableSizeVector.js.map +1 -1
  188. package/dist/vector/vector.d.ts +0 -17
  189. package/dist/vector/vector.js +5 -47
  190. package/dist/vector/vector.js.map +1 -1
  191. package/dist/vector/vectorType.js +2 -5
  192. package/dist/vector/vectorType.js.map +1 -1
  193. package/package.json +10 -31
  194. package/dist/encodings/decodingUtils.js.map +0 -1
  195. package/dist/encodings/doubleDecoder.d.ts +0 -4
  196. package/dist/encodings/doubleDecoder.js +0 -22
  197. package/dist/encodings/doubleDecoder.js.map +0 -1
  198. package/dist/encodings/fastpfor/bitpacking.d.ts +0 -51
  199. package/dist/encodings/fastpfor/bitpacking.js +0 -3930
  200. package/dist/encodings/fastpfor/bitpacking.js.map +0 -1
  201. package/dist/encodings/fastpfor/codec.d.ts +0 -19
  202. package/dist/encodings/fastpfor/codec.js +0 -3
  203. package/dist/encodings/fastpfor/codec.js.map +0 -1
  204. package/dist/encodings/fastpfor/fastpfor.d.ts +0 -38
  205. package/dist/encodings/fastpfor/fastpfor.js +0 -146
  206. package/dist/encodings/fastpfor/fastpfor.js.map +0 -1
  207. package/dist/encodings/fastpfor/index.d.ts +0 -20
  208. package/dist/encodings/fastpfor/index.js +0 -47
  209. package/dist/encodings/fastpfor/index.js.map +0 -1
  210. package/dist/encodings/fastpfor/util.d.ts +0 -2
  211. package/dist/encodings/fastpfor/util.js +0 -16
  212. package/dist/encodings/fastpfor/util.js.map +0 -1
  213. package/dist/encodings/fastpfor/varint.d.ts +0 -18
  214. package/dist/encodings/fastpfor/varint.js +0 -125
  215. package/dist/encodings/fastpfor/varint.js.map +0 -1
  216. package/dist/encodings/fsstDecoder.js.map +0 -1
  217. package/dist/encodings/geometryDecoder.js.map +0 -1
  218. package/dist/encodings/geometryScaling.js +0 -3
  219. package/dist/encodings/geometryScaling.js.map +0 -1
  220. package/dist/encodings/intWrapper.js.map +0 -1
  221. package/dist/encodings/integerDecodingUtils.js.map +0 -1
  222. package/dist/encodings/integerStreamDecoder.js +0 -249
  223. package/dist/encodings/integerStreamDecoder.js.map +0 -1
  224. package/dist/encodings/propertyDecoder.js +0 -146
  225. package/dist/encodings/propertyDecoder.js.map +0 -1
  226. package/dist/encodings/stringDecoder.js +0 -149
  227. package/dist/encodings/stringDecoder.js.map +0 -1
  228. package/dist/metadata/tileset/tilesetMetadata.g.d.ts +0 -418
  229. package/dist/metadata/tileset/tilesetMetadata.g.js +0 -476
  230. package/dist/metadata/tileset/tilesetMetadata.g.js.map +0 -1
  231. package/dist/vector/filter/constSelectionVector.d.ts +0 -0
  232. package/dist/vector/filter/constSelectionVector.js +0 -1
  233. package/dist/vector/filter/constSelectionVector.js.map +0 -1
  234. package/dist/vector/filter/flatSelectionVector.d.ts +0 -16
  235. package/dist/vector/filter/flatSelectionVector.js +0 -42
  236. package/dist/vector/filter/flatSelectionVector.js.map +0 -1
  237. package/dist/vector/filter/selectionVector.d.ts +0 -8
  238. package/dist/vector/filter/selectionVector.js +0 -3
  239. package/dist/vector/filter/selectionVector.js.map +0 -1
  240. package/dist/vector/filter/selectionVectorUtils.d.ts +0 -7
  241. package/dist/vector/filter/selectionVectorUtils.js +0 -44
  242. package/dist/vector/filter/selectionVectorUtils.js.map +0 -1
  243. package/dist/vector/filter/sequenceSelectionVector.d.ts +0 -0
  244. package/dist/vector/filter/sequenceSelectionVector.js +0 -1
  245. package/dist/vector/filter/sequenceSelectionVector.js.map +0 -1
  246. package/dist/vector/geometry/point.d.ts +0 -195
  247. package/dist/vector/geometry/point.js +0 -308
  248. package/dist/vector/geometry/point.js.map +0 -1
  249. /package/dist/{encodings → decoding}/decodingUtils.d.ts +0 -0
  250. /package/dist/{encodings → decoding}/fsstDecoder.d.ts +0 -0
  251. /package/dist/{encodings → decoding}/geometryDecoder.d.ts +0 -0
  252. /package/dist/{encodings → decoding}/geometryScaling.d.ts +0 -0
  253. /package/dist/{encodings → decoding}/intWrapper.d.ts +0 -0
@@ -1,195 +0,0 @@
1
- export default class Point {
2
- x: any;
3
- y: any;
4
- /**
5
- * A standalone point geometry with useful accessor, comparison, and
6
- * modification methods.
7
- *
8
- * @class
9
- * @param {number} x the x-coordinate. This could be longitude or screen pixels, or any other sort of unit.
10
- * @param {number} y the y-coordinate. This could be latitude or screen pixels, or any other sort of unit.
11
- *
12
- * @example
13
- * const point = new Point(-77, 38);
14
- */
15
- constructor(x: any, y: any);
16
- /**
17
- * Clone this point, returning a new point that can be modified
18
- * without affecting the old one.
19
- * @return {Point} the clone
20
- */
21
- clone(): Point;
22
- /**
23
- * Add this point's x & y coordinates to another point,
24
- * yielding a new point.
25
- * @param {Point} p the other point
26
- * @return {Point} output point
27
- */
28
- add(p: any): Point;
29
- /**
30
- * Subtract this point's x & y coordinates to from point,
31
- * yielding a new point.
32
- * @param {Point} p the other point
33
- * @return {Point} output point
34
- */
35
- sub(p: any): Point;
36
- /**
37
- * Multiply this point's x & y coordinates by point,
38
- * yielding a new point.
39
- * @param {Point} p the other point
40
- * @return {Point} output point
41
- */
42
- multByPoint(p: any): Point;
43
- /**
44
- * Divide this point's x & y coordinates by point,
45
- * yielding a new point.
46
- * @param {Point} p the other point
47
- * @return {Point} output point
48
- */
49
- divByPoint(p: any): Point;
50
- /**
51
- * Multiply this point's x & y coordinates by a factor,
52
- * yielding a new point.
53
- * @param {number} k factor
54
- * @return {Point} output point
55
- */
56
- mult(k: any): Point;
57
- /**
58
- * Divide this point's x & y coordinates by a factor,
59
- * yielding a new point.
60
- * @param {number} k factor
61
- * @return {Point} output point
62
- */
63
- div(k: any): Point;
64
- /**
65
- * Rotate this point around the 0, 0 origin by an angle a,
66
- * given in radians
67
- * @param {number} a angle to rotate around, in radians
68
- * @return {Point} output point
69
- */
70
- rotate(a: any): Point;
71
- /**
72
- * Rotate this point around p point by an angle a,
73
- * given in radians
74
- * @param {number} a angle to rotate around, in radians
75
- * @param {Point} p Point to rotate around
76
- * @return {Point} output point
77
- */
78
- rotateAround(a: any, p: any): Point;
79
- /**
80
- * Multiply this point by a 4x1 transformation matrix
81
- * @param {[number, number, number, number]} m transformation matrix
82
- * @return {Point} output point
83
- */
84
- matMult(m: any): Point;
85
- /**
86
- * Calculate this point but as a unit vector from 0, 0, meaning
87
- * that the distance from the resulting point to the 0, 0
88
- * coordinate will be equal to 1 and the angle from the resulting
89
- * point to the 0, 0 coordinate will be the same as before.
90
- * @return {Point} unit vector point
91
- */
92
- unit(): Point;
93
- /**
94
- * Compute a perpendicular point, where the new y coordinate
95
- * is the old x coordinate and the new x coordinate is the old y
96
- * coordinate multiplied by -1
97
- * @return {Point} perpendicular point
98
- */
99
- perp(): Point;
100
- /**
101
- * Return a version of this point with the x & y coordinates
102
- * rounded to integers.
103
- * @return {Point} rounded point
104
- */
105
- round(): Point;
106
- /**
107
- * Return the magnitude of this point: this is the Euclidean
108
- * distance from the 0, 0 coordinate to this point's x and y
109
- * coordinates.
110
- * @return {number} magnitude
111
- */
112
- mag(): number;
113
- /**
114
- * Judge whether this point is equal to another point, returning
115
- * true or false.
116
- * @param {Point} other the other point
117
- * @return {boolean} whether the points are equal
118
- */
119
- equals(other: any): boolean;
120
- /**
121
- * Calculate the distance from this point to another point
122
- * @param {Point} p the other point
123
- * @return {number} distance
124
- */
125
- dist(p: any): number;
126
- /**
127
- * Calculate the distance from this point to another point,
128
- * without the square root step. Useful if you're comparing
129
- * relative distances.
130
- * @param {Point} p the other point
131
- * @return {number} distance
132
- */
133
- distSqr(p: any): number;
134
- /**
135
- * Get the angle from the 0, 0 coordinate to this point, in radians
136
- * coordinates.
137
- * @return {number} angle
138
- */
139
- angle(): number;
140
- /**
141
- * Get the angle from this point to another point, in radians
142
- * @param {Point} b the other point
143
- * @return {number} angle
144
- */
145
- angleTo(b: any): number;
146
- /**
147
- * Get the angle between this point and another point, in radians
148
- * @param {Point} b the other point
149
- * @return {number} angle
150
- */
151
- angleWith(b: any): number;
152
- /**
153
- * Find the angle of the two vectors, solving the formula for
154
- * the cross product a x b = |a||b|sin(θ) for θ.
155
- * @param {number} x the x-coordinate
156
- * @param {number} y the y-coordinate
157
- * @return {number} the angle in radians
158
- */
159
- angleWithSep(x: any, y: any): number;
160
- /** @param {[number, number, number, number]} m */
161
- _matMult(m: any): this;
162
- /** @param {Point} p */
163
- _add(p: any): this;
164
- /** @param {Point} p */
165
- _sub(p: any): this;
166
- /** @param {number} k */
167
- _mult(k: any): this;
168
- /** @param {number} k */
169
- _div(k: any): this;
170
- /** @param {Point} p */
171
- _multByPoint(p: any): this;
172
- /** @param {Point} p */
173
- _divByPoint(p: any): this;
174
- _unit(): this;
175
- _perp(): this;
176
- /** @param {number} angle */
177
- _rotate(angle: any): this;
178
- /**
179
- * @param {number} angle
180
- * @param {Point} p
181
- */
182
- _rotateAround(angle: any, p: any): this;
183
- _round(): this;
184
- }
185
- /**
186
- * Construct a point from an array if necessary, otherwise if the input
187
- * is already a Point, return it unchanged.
188
- * @param {Point | [number, number] | {x: number, y: number}} p input value
189
- * @return {Point} constructed point.
190
- * @example
191
- * // this
192
- * var point = Point.convert([0, 1]);
193
- * // is equivalent to
194
- * var point = new Point(0, 1);
195
- */
@@ -1,308 +0,0 @@
1
- "use strict";
2
- //Ts port of https://github.com/mapbox/point-geometry/blob/main/index.js
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- class Point {
5
- /**
6
- * A standalone point geometry with useful accessor, comparison, and
7
- * modification methods.
8
- *
9
- * @class
10
- * @param {number} x the x-coordinate. This could be longitude or screen pixels, or any other sort of unit.
11
- * @param {number} y the y-coordinate. This could be latitude or screen pixels, or any other sort of unit.
12
- *
13
- * @example
14
- * const point = new Point(-77, 38);
15
- */
16
- constructor(x, y) {
17
- this.x = x;
18
- this.y = y;
19
- }
20
- /**
21
- * Clone this point, returning a new point that can be modified
22
- * without affecting the old one.
23
- * @return {Point} the clone
24
- */
25
- clone() {
26
- return new Point(this.x, this.y);
27
- }
28
- /**
29
- * Add this point's x & y coordinates to another point,
30
- * yielding a new point.
31
- * @param {Point} p the other point
32
- * @return {Point} output point
33
- */
34
- add(p) {
35
- return this.clone()._add(p);
36
- }
37
- /**
38
- * Subtract this point's x & y coordinates to from point,
39
- * yielding a new point.
40
- * @param {Point} p the other point
41
- * @return {Point} output point
42
- */
43
- sub(p) {
44
- return this.clone()._sub(p);
45
- }
46
- /**
47
- * Multiply this point's x & y coordinates by point,
48
- * yielding a new point.
49
- * @param {Point} p the other point
50
- * @return {Point} output point
51
- */
52
- multByPoint(p) {
53
- return this.clone()._multByPoint(p);
54
- }
55
- /**
56
- * Divide this point's x & y coordinates by point,
57
- * yielding a new point.
58
- * @param {Point} p the other point
59
- * @return {Point} output point
60
- */
61
- divByPoint(p) {
62
- return this.clone()._divByPoint(p);
63
- }
64
- /**
65
- * Multiply this point's x & y coordinates by a factor,
66
- * yielding a new point.
67
- * @param {number} k factor
68
- * @return {Point} output point
69
- */
70
- mult(k) {
71
- return this.clone()._mult(k);
72
- }
73
- /**
74
- * Divide this point's x & y coordinates by a factor,
75
- * yielding a new point.
76
- * @param {number} k factor
77
- * @return {Point} output point
78
- */
79
- div(k) {
80
- return this.clone()._div(k);
81
- }
82
- /**
83
- * Rotate this point around the 0, 0 origin by an angle a,
84
- * given in radians
85
- * @param {number} a angle to rotate around, in radians
86
- * @return {Point} output point
87
- */
88
- rotate(a) {
89
- return this.clone()._rotate(a);
90
- }
91
- /**
92
- * Rotate this point around p point by an angle a,
93
- * given in radians
94
- * @param {number} a angle to rotate around, in radians
95
- * @param {Point} p Point to rotate around
96
- * @return {Point} output point
97
- */
98
- rotateAround(a, p) {
99
- return this.clone()._rotateAround(a, p);
100
- }
101
- /**
102
- * Multiply this point by a 4x1 transformation matrix
103
- * @param {[number, number, number, number]} m transformation matrix
104
- * @return {Point} output point
105
- */
106
- matMult(m) {
107
- return this.clone()._matMult(m);
108
- }
109
- /**
110
- * Calculate this point but as a unit vector from 0, 0, meaning
111
- * that the distance from the resulting point to the 0, 0
112
- * coordinate will be equal to 1 and the angle from the resulting
113
- * point to the 0, 0 coordinate will be the same as before.
114
- * @return {Point} unit vector point
115
- */
116
- unit() {
117
- return this.clone()._unit();
118
- }
119
- /**
120
- * Compute a perpendicular point, where the new y coordinate
121
- * is the old x coordinate and the new x coordinate is the old y
122
- * coordinate multiplied by -1
123
- * @return {Point} perpendicular point
124
- */
125
- perp() {
126
- return this.clone()._perp();
127
- }
128
- /**
129
- * Return a version of this point with the x & y coordinates
130
- * rounded to integers.
131
- * @return {Point} rounded point
132
- */
133
- round() {
134
- return this.clone()._round();
135
- }
136
- /**
137
- * Return the magnitude of this point: this is the Euclidean
138
- * distance from the 0, 0 coordinate to this point's x and y
139
- * coordinates.
140
- * @return {number} magnitude
141
- */
142
- mag() {
143
- return Math.sqrt(this.x * this.x + this.y * this.y);
144
- }
145
- /**
146
- * Judge whether this point is equal to another point, returning
147
- * true or false.
148
- * @param {Point} other the other point
149
- * @return {boolean} whether the points are equal
150
- */
151
- equals(other) {
152
- return this.x === other.x && this.y === other.y;
153
- }
154
- /**
155
- * Calculate the distance from this point to another point
156
- * @param {Point} p the other point
157
- * @return {number} distance
158
- */
159
- dist(p) {
160
- return Math.sqrt(this.distSqr(p));
161
- }
162
- /**
163
- * Calculate the distance from this point to another point,
164
- * without the square root step. Useful if you're comparing
165
- * relative distances.
166
- * @param {Point} p the other point
167
- * @return {number} distance
168
- */
169
- distSqr(p) {
170
- const dx = p.x - this.x, dy = p.y - this.y;
171
- return dx * dx + dy * dy;
172
- }
173
- /**
174
- * Get the angle from the 0, 0 coordinate to this point, in radians
175
- * coordinates.
176
- * @return {number} angle
177
- */
178
- angle() {
179
- return Math.atan2(this.y, this.x);
180
- }
181
- /**
182
- * Get the angle from this point to another point, in radians
183
- * @param {Point} b the other point
184
- * @return {number} angle
185
- */
186
- angleTo(b) {
187
- return Math.atan2(this.y - b.y, this.x - b.x);
188
- }
189
- /**
190
- * Get the angle between this point and another point, in radians
191
- * @param {Point} b the other point
192
- * @return {number} angle
193
- */
194
- angleWith(b) {
195
- return this.angleWithSep(b.x, b.y);
196
- }
197
- /**
198
- * Find the angle of the two vectors, solving the formula for
199
- * the cross product a x b = |a||b|sin(θ) for θ.
200
- * @param {number} x the x-coordinate
201
- * @param {number} y the y-coordinate
202
- * @return {number} the angle in radians
203
- */
204
- angleWithSep(x, y) {
205
- return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
206
- }
207
- /** @param {[number, number, number, number]} m */
208
- _matMult(m) {
209
- const x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
210
- this.x = x;
211
- this.y = y;
212
- return this;
213
- }
214
- /** @param {Point} p */
215
- _add(p) {
216
- this.x += p.x;
217
- this.y += p.y;
218
- return this;
219
- }
220
- /** @param {Point} p */
221
- _sub(p) {
222
- this.x -= p.x;
223
- this.y -= p.y;
224
- return this;
225
- }
226
- /** @param {number} k */
227
- _mult(k) {
228
- this.x *= k;
229
- this.y *= k;
230
- return this;
231
- }
232
- /** @param {number} k */
233
- _div(k) {
234
- this.x /= k;
235
- this.y /= k;
236
- return this;
237
- }
238
- /** @param {Point} p */
239
- _multByPoint(p) {
240
- this.x *= p.x;
241
- this.y *= p.y;
242
- return this;
243
- }
244
- /** @param {Point} p */
245
- _divByPoint(p) {
246
- this.x /= p.x;
247
- this.y /= p.y;
248
- return this;
249
- }
250
- _unit() {
251
- this._div(this.mag());
252
- return this;
253
- }
254
- _perp() {
255
- const y = this.y;
256
- this.y = this.x;
257
- this.x = -y;
258
- return this;
259
- }
260
- /** @param {number} angle */
261
- _rotate(angle) {
262
- const cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
263
- this.x = x;
264
- this.y = y;
265
- return this;
266
- }
267
- /**
268
- * @param {number} angle
269
- * @param {Point} p
270
- */
271
- _rotateAround(angle, p) {
272
- const cos = Math.cos(angle), sin = Math.sin(angle), x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y), y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
273
- this.x = x;
274
- this.y = y;
275
- return this;
276
- }
277
- _round() {
278
- this.x = Math.round(this.x);
279
- this.y = Math.round(this.y);
280
- return this;
281
- }
282
- }
283
- exports.default = Point;
284
- /**
285
- * Construct a point from an array if necessary, otherwise if the input
286
- * is already a Point, return it unchanged.
287
- * @param {Point | [number, number] | {x: number, y: number}} p input value
288
- * @return {Point} constructed point.
289
- * @example
290
- * // this
291
- * var point = Point.convert([0, 1]);
292
- * // is equivalent to
293
- * var point = new Point(0, 1);
294
- */
295
- /*
296
- Point.convert = function (p) {
297
- if (p instanceof Point) {
298
- return /!** @type {Point} *!/ (p);
299
- }
300
- if (Array.isArray(p)) {
301
- return new Point(+p[0], +p[1]);
302
- }
303
- if (p.x !== undefined && p.y !== undefined) {
304
- return new Point(+p.x, +p.y);
305
- }
306
- throw new Error('Expected [x, y] or {x, y} point format');
307
- };*/
308
- //# sourceMappingURL=point.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"point.js","sourceRoot":"","sources":["../../../src/vector/geometry/point.ts"],"names":[],"mappings":";AAAA,wEAAwE;;AAExE,MAAqB,KAAK;IACtB;;;;;;;;;;OAUG;IACH,YACW,CAAC,EACD,CAAC;QADD,MAAC,GAAD,CAAC,CAAA;QACD,MAAC,GAAD,CAAC,CAAA;IACT,CAAC;IAEJ;;;;OAIG;IACH,KAAK;QACD,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,CAAC;QACT,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,CAAC;QACR,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAA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