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