@math.gl/core 5.0.0-alpha.2 → 5.0.0-alpha.20

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 (272) hide show
  1. package/APACHE-2.0-LICENSE.txt +55 -0
  2. package/ARROW-NOTICE.txt +18 -0
  3. package/LICENSE +149 -40
  4. package/PROJ4-LICENSE.md +29 -0
  5. package/README.md +14 -0
  6. package/THIRD-PARTY-NOTICES.md +16 -0
  7. package/dist/classes/base/math-array.d.ts +1 -1
  8. package/dist/classes/base/math-array.d.ts.map +1 -1
  9. package/dist/classes/base/math-array.js +1 -1
  10. package/dist/classes/base/math-array.js.map +1 -1
  11. package/dist/classes/base/matrix.d.ts +1 -1
  12. package/dist/classes/base/matrix.d.ts.map +1 -1
  13. package/dist/classes/base/matrix.js +2 -2
  14. package/dist/classes/base/matrix.js.map +1 -1
  15. package/dist/classes/base/vector.d.ts +1 -1
  16. package/dist/classes/base/vector.d.ts.map +1 -1
  17. package/dist/classes/base/vector.js +2 -2
  18. package/dist/classes/base/vector.js.map +1 -1
  19. package/dist/classes/euler-types.js +1 -1
  20. package/dist/classes/euler-types.js.map +1 -1
  21. package/dist/classes/euler.d.ts +1 -1
  22. package/dist/classes/euler.d.ts.map +1 -1
  23. package/dist/classes/euler.js +4 -2
  24. package/dist/classes/euler.js.map +1 -1
  25. package/dist/classes/matrix3.d.ts +1 -1
  26. package/dist/classes/matrix3.d.ts.map +1 -1
  27. package/dist/classes/matrix3.js +2 -2
  28. package/dist/classes/matrix3.js.map +1 -1
  29. package/dist/classes/matrix4.d.ts +1 -1
  30. package/dist/classes/matrix4.d.ts.map +1 -1
  31. package/dist/classes/matrix4.js +2 -2
  32. package/dist/classes/matrix4.js.map +1 -1
  33. package/dist/classes/pose.d.ts +1 -1
  34. package/dist/classes/pose.d.ts.map +1 -1
  35. package/dist/classes/pose.js +2 -2
  36. package/dist/classes/pose.js.map +1 -1
  37. package/dist/classes/quaternion.d.ts +1 -1
  38. package/dist/classes/quaternion.d.ts.map +1 -1
  39. package/dist/classes/quaternion.js +2 -2
  40. package/dist/classes/quaternion.js.map +1 -1
  41. package/dist/classes/spherical-coordinates.js +2 -2
  42. package/dist/classes/spherical-coordinates.js.map +1 -1
  43. package/dist/classes/vector2.d.ts +1 -1
  44. package/dist/classes/vector2.d.ts.map +1 -1
  45. package/dist/classes/vector2.js +2 -2
  46. package/dist/classes/vector2.js.map +1 -1
  47. package/dist/classes/vector3.d.ts +1 -1
  48. package/dist/classes/vector3.d.ts.map +1 -1
  49. package/dist/classes/vector3.js +2 -2
  50. package/dist/classes/vector3.js.map +1 -1
  51. package/dist/classes/vector4.d.ts +1 -1
  52. package/dist/classes/vector4.d.ts.map +1 -1
  53. package/dist/classes/vector4.js +2 -2
  54. package/dist/classes/vector4.js.map +1 -1
  55. package/dist/expressions/expression-eval.d.ts +98 -0
  56. package/dist/expressions/expression-eval.d.ts.map +1 -0
  57. package/dist/expressions/expression-eval.js +302 -0
  58. package/dist/expressions/expression-eval.js.map +1 -0
  59. package/dist/expressions/function-libraries.d.ts +60 -0
  60. package/dist/expressions/function-libraries.d.ts.map +1 -0
  61. package/dist/expressions/function-libraries.js +69 -0
  62. package/dist/expressions/function-libraries.js.map +1 -0
  63. package/dist/expressions/function-registry.d.ts +93 -0
  64. package/dist/expressions/function-registry.d.ts.map +1 -0
  65. package/dist/expressions/function-registry.js +139 -0
  66. package/dist/expressions/function-registry.js.map +1 -0
  67. package/dist/expressions/get.d.ts +9 -0
  68. package/dist/expressions/get.d.ts.map +1 -0
  69. package/dist/expressions/get.js +32 -0
  70. package/dist/expressions/get.js.map +1 -0
  71. package/dist/expressions/index.cjs +1491 -0
  72. package/dist/expressions/index.cjs.map +6 -0
  73. package/dist/expressions/index.d.ts +7 -0
  74. package/dist/expressions/index.d.ts.map +1 -0
  75. package/dist/expressions/index.js +8 -0
  76. package/dist/expressions/index.js.map +1 -0
  77. package/dist/expressions/parse-expression-string.d.ts +21 -0
  78. package/dist/expressions/parse-expression-string.d.ts.map +1 -0
  79. package/dist/expressions/parse-expression-string.js +61 -0
  80. package/dist/expressions/parse-expression-string.js.map +1 -0
  81. package/dist/expressions/vendor/jsep/runtime.d.ts +3 -0
  82. package/dist/expressions/vendor/jsep/runtime.d.ts.map +1 -0
  83. package/dist/expressions/vendor/jsep/runtime.js +972 -0
  84. package/dist/expressions/vendor/jsep/runtime.js.map +1 -0
  85. package/dist/expressions/vendor/jsep/types.d.ts +141 -0
  86. package/dist/expressions/vendor/jsep/types.d.ts.map +1 -0
  87. package/dist/expressions/vendor/jsep/types.js +4 -0
  88. package/dist/expressions/vendor/jsep/types.js.map +1 -0
  89. package/dist/gl-matrix/common.d.ts +1 -1
  90. package/dist/gl-matrix/common.d.ts.map +1 -1
  91. package/dist/gl-matrix/common.js +5 -0
  92. package/dist/gl-matrix/common.js.map +1 -1
  93. package/dist/gl-matrix/mat3.d.ts.map +1 -1
  94. package/dist/gl-matrix/mat3.js +5 -0
  95. package/dist/gl-matrix/mat3.js.map +1 -1
  96. package/dist/gl-matrix/mat4.d.ts.map +1 -1
  97. package/dist/gl-matrix/mat4.js +5 -0
  98. package/dist/gl-matrix/mat4.js.map +1 -1
  99. package/dist/gl-matrix/quat.d.ts.map +1 -1
  100. package/dist/gl-matrix/quat.js +5 -0
  101. package/dist/gl-matrix/quat.js.map +1 -1
  102. package/dist/gl-matrix/vec2.d.ts +1 -1
  103. package/dist/gl-matrix/vec2.d.ts.map +1 -1
  104. package/dist/gl-matrix/vec2.js +5 -0
  105. package/dist/gl-matrix/vec2.js.map +1 -1
  106. package/dist/gl-matrix/vec3.d.ts.map +1 -1
  107. package/dist/gl-matrix/vec3.js +5 -0
  108. package/dist/gl-matrix/vec3.js.map +1 -1
  109. package/dist/gl-matrix/vec4.d.ts.map +1 -1
  110. package/dist/gl-matrix/vec4.js +5 -0
  111. package/dist/gl-matrix/vec4.js.map +1 -1
  112. package/dist/gl-matrix/wip/index.d.ts.map +1 -1
  113. package/dist/gl-matrix/wip/index.js +3 -1
  114. package/dist/gl-matrix/wip/index.js.map +1 -1
  115. package/dist/gl-matrix/wip/mat2.d.ts.map +1 -1
  116. package/dist/gl-matrix/wip/mat2.js +3 -1
  117. package/dist/gl-matrix/wip/mat2.js.map +1 -1
  118. package/dist/gl-matrix/wip/mat2d.d.ts.map +1 -1
  119. package/dist/gl-matrix/wip/mat2d.js +3 -1
  120. package/dist/gl-matrix/wip/mat2d.js.map +1 -1
  121. package/dist/gl-matrix/wip/quat2.d.ts.map +1 -1
  122. package/dist/gl-matrix/wip/quat2.js +3 -1
  123. package/dist/gl-matrix/wip/quat2.js.map +1 -1
  124. package/dist/index.cjs.map +1 -1
  125. package/dist/index.d.ts +3 -2
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +1 -1
  128. package/dist/index.js.map +1 -1
  129. package/dist/lib/assert.js +1 -1
  130. package/dist/lib/assert.js.map +1 -1
  131. package/dist/lib/common.d.ts +1 -1
  132. package/dist/lib/common.d.ts.map +1 -1
  133. package/dist/lib/common.js +1 -1
  134. package/dist/lib/common.js.map +1 -1
  135. package/dist/lib/gl-matrix-extras.d.ts +1 -1
  136. package/dist/lib/gl-matrix-extras.d.ts.map +1 -1
  137. package/dist/lib/gl-matrix-extras.js +1 -1
  138. package/dist/lib/gl-matrix-extras.js.map +1 -1
  139. package/dist/lib/math-utils.d.ts.map +1 -1
  140. package/dist/lib/math-utils.js +2 -1
  141. package/dist/lib/math-utils.js.map +1 -1
  142. package/dist/lib/validators.d.ts +1 -1
  143. package/dist/lib/validators.d.ts.map +1 -1
  144. package/dist/lib/validators.js +1 -1
  145. package/dist/lib/validators.js.map +1 -1
  146. package/dist/local-frame.cjs +139 -0
  147. package/dist/local-frame.cjs.map +6 -0
  148. package/dist/local-frame.d.ts +39 -0
  149. package/dist/local-frame.d.ts.map +1 -0
  150. package/dist/local-frame.js +157 -0
  151. package/dist/local-frame.js.map +1 -0
  152. package/dist/mat3.cjs.map +1 -1
  153. package/dist/mat3.js +1 -1
  154. package/dist/mat3.js.map +1 -1
  155. package/dist/mat4.cjs.map +1 -1
  156. package/dist/mat4.js +1 -1
  157. package/dist/mat4.js.map +1 -1
  158. package/dist/quat.cjs.map +1 -1
  159. package/dist/quat.js +1 -1
  160. package/dist/quat.js.map +1 -1
  161. package/dist/spheroid.cjs +147 -0
  162. package/dist/spheroid.cjs.map +6 -0
  163. package/dist/spheroid.d.ts +21 -0
  164. package/dist/spheroid.d.ts.map +1 -0
  165. package/dist/spheroid.js +175 -0
  166. package/dist/spheroid.js.map +1 -0
  167. package/dist/types/array-types.d.ts +98 -0
  168. package/dist/types/array-types.d.ts.map +1 -0
  169. package/dist/types/array-types.js +6 -0
  170. package/dist/types/array-types.js.map +1 -0
  171. package/dist/types/bigint.d.ts +21 -0
  172. package/dist/types/bigint.d.ts.map +1 -0
  173. package/dist/types/bigint.js +65 -0
  174. package/dist/types/bigint.js.map +1 -0
  175. package/dist/types/bounds-types.d.ts +11 -0
  176. package/dist/types/bounds-types.d.ts.map +1 -0
  177. package/dist/types/bounds-types.js +17 -0
  178. package/dist/types/bounds-types.js.map +1 -0
  179. package/dist/types/float16.d.ts +32 -0
  180. package/dist/types/float16.d.ts.map +1 -0
  181. package/dist/types/float16.js +41 -0
  182. package/dist/types/float16.js.map +1 -0
  183. package/dist/types/index.d.ts +6 -0
  184. package/dist/types/index.d.ts.map +1 -0
  185. package/dist/types/index.js +6 -0
  186. package/dist/types/index.js.map +1 -0
  187. package/dist/types/is-array.d.ts +22 -0
  188. package/dist/types/is-array.d.ts.map +1 -0
  189. package/dist/types/is-array.js +36 -0
  190. package/dist/types/is-array.js.map +1 -0
  191. package/dist/types/spheroid.d.ts +8 -0
  192. package/dist/types/spheroid.d.ts.map +1 -0
  193. package/dist/types/spheroid.js +5 -0
  194. package/dist/types/spheroid.js.map +1 -0
  195. package/dist/types/typed-array-brand.d.ts +2 -0
  196. package/dist/types/typed-array-brand.d.ts.map +1 -0
  197. package/dist/types/typed-array-brand.js +10 -0
  198. package/dist/types/typed-array-brand.js.map +1 -0
  199. package/dist/types.cjs +67 -0
  200. package/dist/types.cjs.map +6 -0
  201. package/dist/types.d.ts +2 -0
  202. package/dist/types.d.ts.map +1 -0
  203. package/dist/types.js +5 -0
  204. package/dist/types.js.map +1 -0
  205. package/dist/vec2.cjs.map +1 -1
  206. package/dist/vec2.js +1 -1
  207. package/dist/vec2.js.map +1 -1
  208. package/dist/vec3.cjs.map +1 -1
  209. package/dist/vec3.js +1 -1
  210. package/dist/vec3.js.map +1 -1
  211. package/dist/vec4.cjs.map +1 -1
  212. package/dist/vec4.js +1 -1
  213. package/dist/vec4.js.map +1 -1
  214. package/package.json +28 -6
  215. package/src/classes/base/math-array.ts +2 -2
  216. package/src/classes/base/matrix.ts +3 -3
  217. package/src/classes/base/vector.ts +3 -3
  218. package/src/classes/euler-types.ts +1 -1
  219. package/src/classes/euler.ts +5 -3
  220. package/src/classes/matrix3.ts +3 -3
  221. package/src/classes/matrix4.ts +3 -3
  222. package/src/classes/pose.ts +3 -3
  223. package/src/classes/quaternion.ts +3 -3
  224. package/src/classes/spherical-coordinates.ts +2 -2
  225. package/src/classes/vector2.ts +3 -3
  226. package/src/classes/vector3.ts +3 -3
  227. package/src/classes/vector4.ts +3 -3
  228. package/src/expressions/expression-eval.ts +435 -0
  229. package/src/expressions/function-libraries.ts +123 -0
  230. package/src/expressions/function-registry.ts +171 -0
  231. package/src/expressions/get.ts +37 -0
  232. package/src/expressions/index.ts +22 -0
  233. package/src/expressions/parse-expression-string.ts +80 -0
  234. package/src/expressions/vendor/jsep/LICENSE.txt +23 -0
  235. package/src/expressions/vendor/jsep/README.md +22 -0
  236. package/src/expressions/vendor/jsep/runtime.ts +949 -0
  237. package/src/expressions/vendor/jsep/types.ts +179 -0
  238. package/src/gl-matrix/common.js +5 -0
  239. package/src/gl-matrix/mat3.ts +5 -0
  240. package/src/gl-matrix/mat4.ts +5 -0
  241. package/src/gl-matrix/quat.ts +5 -0
  242. package/src/gl-matrix/vec2.ts +6 -1
  243. package/src/gl-matrix/vec3.ts +5 -0
  244. package/src/gl-matrix/vec4.ts +5 -0
  245. package/src/gl-matrix/wip/index.js +3 -1
  246. package/src/gl-matrix/wip/mat2.js +3 -1
  247. package/src/gl-matrix/wip/mat2d.js +3 -1
  248. package/src/gl-matrix/wip/quat2.ts +3 -1
  249. package/src/index.ts +5 -3
  250. package/src/lib/assert.ts +1 -1
  251. package/src/lib/common.ts +2 -2
  252. package/src/lib/gl-matrix-extras.ts +2 -2
  253. package/src/lib/gl-matrix.d.ts +1 -1
  254. package/src/lib/math-utils.ts +2 -1
  255. package/src/lib/validators.ts +2 -2
  256. package/src/local-frame.ts +253 -0
  257. package/src/mat3.ts +1 -1
  258. package/src/mat4.ts +1 -1
  259. package/src/quat.ts +1 -1
  260. package/src/spheroid.ts +230 -0
  261. package/src/types/array-types.ts +148 -0
  262. package/src/types/bigint.ts +74 -0
  263. package/src/types/bounds-types.ts +29 -0
  264. package/src/types/float16.ts +47 -0
  265. package/src/types/index.ts +45 -0
  266. package/src/types/is-array.ts +41 -0
  267. package/src/types/spheroid.ts +11 -0
  268. package/src/types/typed-array-brand.ts +14 -0
  269. package/src/types.ts +5 -0
  270. package/src/vec2.ts +1 -1
  271. package/src/vec3.ts +1 -1
  272. package/src/vec4.ts +1 -1
@@ -0,0 +1,179 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // SPDX-FileCopyrightText: Copyright (c) 2013 Stephen Oney
3
+
4
+ declare namespace jsep {
5
+ export type baseTypes = string | number | boolean | RegExp | null | undefined | object;
6
+ export interface Expression {
7
+ type: string;
8
+ [key: string]: baseTypes | Expression | Array<baseTypes | Expression>;
9
+ }
10
+
11
+ export interface ArrayExpression extends Expression {
12
+ type: 'ArrayExpression';
13
+ /** The expression can be null in the case of array holes ([ , , ]) */
14
+ elements: Array<null | Expression>;
15
+ }
16
+
17
+ export interface BinaryExpression extends Expression {
18
+ type: 'BinaryExpression';
19
+ operator: string;
20
+ left: Expression;
21
+ right: Expression;
22
+ }
23
+
24
+ export interface CallExpression extends Expression {
25
+ type: 'CallExpression';
26
+ arguments: Expression[];
27
+ callee: Expression;
28
+ }
29
+
30
+ export interface Compound extends Expression {
31
+ type: 'Compound';
32
+ body: Expression[];
33
+ }
34
+
35
+ export interface SequenceExpression extends Expression {
36
+ type: 'SequenceExpression';
37
+ expressions: Expression[];
38
+ }
39
+
40
+ export interface ConditionalExpression extends Expression {
41
+ type: 'ConditionalExpression';
42
+ test: Expression;
43
+ consequent: Expression;
44
+ alternate: Expression;
45
+ }
46
+
47
+ export interface Identifier extends Expression {
48
+ type: 'Identifier';
49
+ name: string;
50
+ }
51
+
52
+ export interface Literal extends Expression {
53
+ type: 'Literal';
54
+ value: boolean | number | string | RegExp | null;
55
+ raw: string;
56
+ }
57
+
58
+ export interface MemberExpression extends Expression {
59
+ type: 'MemberExpression';
60
+ computed: boolean;
61
+ object: Expression;
62
+ property: Expression;
63
+ optional?: boolean;
64
+ }
65
+
66
+ export interface ThisExpression extends Expression {
67
+ type: 'ThisExpression';
68
+ }
69
+
70
+ export interface UnaryExpression extends Expression {
71
+ type: 'UnaryExpression';
72
+ operator: string;
73
+ argument: Expression;
74
+ prefix: boolean;
75
+ }
76
+
77
+ export type ExpressionType =
78
+ 'Compound'
79
+ | 'SequenceExpression'
80
+ | 'Identifier'
81
+ | 'MemberExpression'
82
+ | 'Literal'
83
+ | 'ThisExpression'
84
+ | 'CallExpression'
85
+ | 'UnaryExpression'
86
+ | 'BinaryExpression'
87
+ | 'ConditionalExpression'
88
+ | 'ArrayExpression';
89
+
90
+ export type CoreExpression =
91
+ ArrayExpression
92
+ | BinaryExpression
93
+ | CallExpression
94
+ | Compound
95
+ | SequenceExpression
96
+ | ConditionalExpression
97
+ | Identifier
98
+ | Literal
99
+ | MemberExpression
100
+ | ThisExpression
101
+ | UnaryExpression;
102
+
103
+ export type PossibleExpression = Expression | undefined;
104
+ export interface HookScope {
105
+ index: number;
106
+ readonly expr: string;
107
+ readonly char: string; // current character of the expression
108
+ readonly code: number; // current character code of the expression
109
+ gobbleSpaces: () => void;
110
+ gobbleExpressions: (untilICode?: number) => Expression[];
111
+ gobbleExpression: () => Expression;
112
+ gobbleBinaryOp: () => PossibleExpression;
113
+ gobbleBinaryExpression: () => PossibleExpression;
114
+ gobbleToken: () => PossibleExpression;
115
+ gobbleTokenProperty: (node: Expression) => Expression
116
+ gobbleNumericLiteral: () => PossibleExpression;
117
+ gobbleStringLiteral: () => PossibleExpression;
118
+ gobbleIdentifier: () => PossibleExpression;
119
+ gobbleArguments: (untilICode: number) => PossibleExpression;
120
+ gobbleGroup: () => Expression;
121
+ gobbleArray: () => PossibleExpression;
122
+ throwError: (msg: string) => never;
123
+ }
124
+
125
+ export type HookType = 'gobble-expression' | 'after-expression' | 'gobble-token' | 'after-token' | 'gobble-spaces';
126
+ export type HookCallback = (this: HookScope, env: { node?: Expression }) => void;
127
+ type HookTypeObj = Partial<{ [key in HookType]: HookCallback}>
128
+
129
+ export interface IHooks extends HookTypeObj {
130
+ add(name: HookType, cb: HookCallback, first?: boolean): void;
131
+ add(obj: { [name in HookType]: HookCallback }, first?: boolean): void;
132
+ run(name: string, env: { context?: typeof jsep, node?: Expression }): void;
133
+ }
134
+ let hooks: IHooks;
135
+
136
+ export interface IPlugin {
137
+ name: string;
138
+ init: (this: typeof jsep) => void;
139
+ }
140
+ export interface IPlugins {
141
+ registered: { [name: string]: IPlugin };
142
+ register: (...plugins: IPlugin[]) => void;
143
+ }
144
+ let plugins: IPlugins;
145
+
146
+ let unary_ops: { [op: string]: any };
147
+ let binary_ops: { [op: string]: number };
148
+ let right_associative: Set<string>;
149
+ let additional_identifier_chars: Set<string>;
150
+ let literals: { [literal: string]: any };
151
+ let this_str: string;
152
+
153
+ function addBinaryOp(operatorName: string, precedence: number, rightToLeft?: boolean): void;
154
+
155
+ function addUnaryOp(operatorName: string): void;
156
+
157
+ function addLiteral(literalName: string, literalValue: any): void;
158
+
159
+ function addIdentifierChar(identifierName: string): void;
160
+
161
+ function removeBinaryOp(operatorName: string): void;
162
+
163
+ function removeUnaryOp(operatorName: string): void;
164
+
165
+ function removeLiteral(literalName: string): void;
166
+
167
+ function removeIdentifierChar(identifierName: string): void;
168
+
169
+ function removeAllBinaryOps(): void;
170
+
171
+ function removeAllUnaryOps(): void;
172
+
173
+ function removeAllLiterals(): void;
174
+
175
+ const version: string;
176
+ }
177
+
178
+ declare function jsep(val: string | jsep.Expression): jsep.Expression;
179
+ export type {jsep as Jsep};
@@ -1,3 +1,8 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
1
6
  // @eslint-disable
2
7
  // @ts-nocheck
3
8
 
@@ -1,3 +1,8 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
1
6
  import * as glMatrix from './common.js';
2
7
 
3
8
  /**
@@ -1,3 +1,8 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
1
6
  // @eslint-disable
2
7
  // @ts-nocheck
3
8
 
@@ -1,3 +1,8 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
1
6
  // @eslint-disable
2
7
  // @ts-nocheck
3
8
 
@@ -1,7 +1,12 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
1
6
  // @eslint-disable
2
7
  // @ts-nocheck
3
8
 
4
- import type {NumericArray} from '@math.gl/types';
9
+ import type {NumericArray} from '../types';
5
10
  import * as glMatrix from './common.js';
6
11
 
7
12
  /**
@@ -1,3 +1,8 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
1
6
  // @eslint-disable
2
7
  // @ts-nocheck
3
8
 
@@ -1,3 +1,8 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
1
6
  // @eslint-disable
2
7
  // @ts-nocheck
3
8
 
@@ -1,6 +1,8 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
4
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
4
6
 
5
7
  // @eslint-disable
6
8
  // @ts-nocheck
@@ -1,6 +1,8 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
4
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
4
6
 
5
7
  // @ts-nocheck
6
8
  /* eslint-disable */
@@ -1,6 +1,8 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
4
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
4
6
 
5
7
  // @ts-nocheck
6
8
  /* eslint-disable */
@@ -1,6 +1,8 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. (gl-matrix)
4
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
5
+ // SPDX-FileComment: Adapted from gl-matrix. See the repository LICENSE for upstream attribution and terms.
4
6
 
5
7
  // @ts-nocheck
6
8
  /* eslint-disable */
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  // types
6
6
  export type {
@@ -16,9 +16,9 @@ export type {
16
16
  NumberArray9,
17
17
  NumberArray12,
18
18
  NumberArray16
19
- } from '@math.gl/types';
19
+ } from './types';
20
20
 
21
- export type {isTypedArray, isNumberArray, isNumericArray} from '@math.gl/types';
21
+ export type {isTypedArray, isNumberArray, isNumericArray} from './types';
22
22
 
23
23
  // classes
24
24
  export {MathArray as _MathArray} from './classes/base/math-array';
@@ -68,3 +68,5 @@ export {
68
68
  lerp,
69
69
  withEpsilon
70
70
  } from './lib/common';
71
+
72
+ export type {SpheroidParameters} from './types';
package/src/lib/assert.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  export function assert(condition: unknown, message?: string): void {
6
6
  if (!condition) {
package/src/lib/common.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  /* eslint-disable no-shadow */ // radians and degrees are common variable names
6
6
 
7
- import type {NumericArray} from '@math.gl/types';
7
+ import type {NumericArray} from '../types';
8
8
 
9
9
  import type {MathArray} from '../classes/base/math-array';
10
10
  import {EPSILON14, TWO_PI, PI} from './math-utils';
@@ -1,9 +1,9 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  /* eslint-disable camelcase */
6
- import {NumericArray} from '@math.gl/types';
6
+ import {NumericArray} from '../types';
7
7
  // vec2 additions
8
8
 
9
9
  export function vec2_transformMat4AsVector<T extends NumericArray>(
@@ -1,6 +1,6 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  // Float16Array is declared in a separate TypeScript library. This reference affects types only.
6
6
  // eslint-disable-next-line spaced-comment
@@ -1,6 +1,7 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileComment: Original compatibility helpers for Cesium-derived tests.
4
5
 
5
6
  // NOTE: Added to make Cesium-derived test cases work
6
7
  // TODO: Determine if/how to keep
@@ -1,8 +1,8 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- import {NumericArray} from '@math.gl/types';
5
+ import {NumericArray} from '../types';
6
6
  import {config} from './common';
7
7
 
8
8
  export function validateVector(v: NumericArray, length: number): boolean {
@@ -0,0 +1,253 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileComment: Original factored ENU/NED basis, rotations and matrix commits. No CesiumJS or PROJ source is copied.
5
+ import type {NumericArray} from './types';
6
+
7
+ export type LocalFramePoint = {x: number; y: number; z: number};
8
+ export type LocalFrameAxis = 'east' | 'north' | 'up' | 'west' | 'south' | 'down';
9
+ /** East has zero Z. North is up × east; northZ is its horizontal radial factor. */
10
+ export type LocalFrameBasis = {
11
+ eastX: number;
12
+ eastY: number;
13
+ northZ: number;
14
+ upX: number;
15
+ upY: number;
16
+ upZ: number;
17
+ };
18
+
19
+ /** Setup-time scratch, initially the ENU basis at longitude/latitude zero. */
20
+ export function createLocalFrameBasis(): LocalFrameBasis {
21
+ return {eastX: 0, eastY: 1, northZ: 1, upX: 1, upY: 0, upZ: 0};
22
+ }
23
+
24
+ /** Angles in radians. Longitude is periodic; latitude must be within ±π/2. */
25
+ export function eastNorthUpBasis(
26
+ longitude: number,
27
+ latitude: number,
28
+ result: LocalFrameBasis
29
+ ): boolean {
30
+ if (!Number.isFinite(longitude) || !Number.isFinite(latitude) || Math.abs(latitude) > Math.PI / 2)
31
+ return false;
32
+ const sl = Math.sin(longitude),
33
+ cl = Math.cos(longitude);
34
+ const sp = Math.sin(latitude),
35
+ cp = Math.cos(latitude);
36
+ return commitBasis(result, -sl, cl, cp, cp * cl, cp * sl, sp);
37
+ }
38
+
39
+ /**
40
+ * Caller supplies finite unit east/up directions, east.z=0, mutually perpendicular,
41
+ * and an up direction whose horizontal component points radially outward.
42
+ * This form preserves supplied up components rather than inferring a geodetic footpoint.
43
+ * Finiteness is checked; orthonormality is a caller precondition, not certified here.
44
+ */
45
+ export function eastNorthUpBasisFromDirections(
46
+ east: LocalFramePoint,
47
+ up: LocalFramePoint,
48
+ result: LocalFrameBasis
49
+ ): boolean {
50
+ const ex = east.x,
51
+ ey = east.y,
52
+ ez = east.z;
53
+ const ux = up.x,
54
+ uy = up.y,
55
+ uz = up.z;
56
+ if (ez !== 0) return false;
57
+ return commitBasis(result, ex, ey, ux * ey - uy * ex, ux, uy, uz);
58
+ }
59
+
60
+ /** Rotate ENU offsets/velocities to fixed XYZ. Distances retain the input unit. */
61
+ export function localToFixed(
62
+ point: LocalFramePoint,
63
+ basis: LocalFrameBasis,
64
+ result: LocalFramePoint = point
65
+ ): boolean {
66
+ const sl = -basis.eastX,
67
+ cl = basis.eastY,
68
+ sp = basis.upZ,
69
+ cp = basis.northZ;
70
+ const east = point.x,
71
+ north = point.y,
72
+ up = point.z;
73
+ // Retain the factored rotation order used by deformation; no intermediate vector.
74
+ const radial = up * cp - north * sp;
75
+ return commitPoint(
76
+ result,
77
+ radial * cl - east * sl,
78
+ radial * sl + east * cl,
79
+ up * sp + north * cp
80
+ );
81
+ }
82
+
83
+ /** Transpose rotation, valid for the orthonormal ENU basis precondition. */
84
+ export function fixedToLocal(
85
+ point: LocalFramePoint,
86
+ basis: LocalFrameBasis,
87
+ result: LocalFramePoint = point
88
+ ): boolean {
89
+ const ex = basis.eastX,
90
+ ey = basis.eastY,
91
+ nz = basis.northZ;
92
+ const ux = basis.upX,
93
+ uy = basis.upY,
94
+ uz = basis.upZ;
95
+ const x = point.x,
96
+ y = point.y,
97
+ z = point.z;
98
+ return commitPoint(
99
+ result,
100
+ x * ex + y * ey,
101
+ -x * uz * ey + y * uz * ex + z * nz,
102
+ x * ux + y * uy + z * uz
103
+ );
104
+ }
105
+
106
+ /**
107
+ * Column-major affine matrix, with explicit signed local axes and fixed-space origin.
108
+ * Axis triples must be right handed (e.g. east/north/up or north/east/down).
109
+ * Translation uses the origin's distance unit. The basis itself has no origin.
110
+ * A failure leaves output unchanged; caller owns writable storage (a growable number array or a typed array of length ≥16).
111
+ */
112
+ export function localFrameToMatrix(
113
+ basis: LocalFrameBasis,
114
+ origin: LocalFramePoint,
115
+ firstAxis: LocalFrameAxis,
116
+ secondAxis: LocalFrameAxis,
117
+ thirdAxis: LocalFrameAxis,
118
+ result: NumericArray
119
+ ): boolean {
120
+ const first = axisCode(firstAxis),
121
+ second = axisCode(secondAxis),
122
+ third = axisCode(thirdAxis);
123
+ const a = Math.abs(first),
124
+ b = Math.abs(second),
125
+ c = Math.abs(third);
126
+ if (!a || !b || !c || a === b || a === c || b === c) return false;
127
+ const parity = (a % 3) + 1 === b ? 1 : -1;
128
+ if (
129
+ parity * Math.sign(first * second * third) !== 1 ||
130
+ (!Array.isArray(result) && result.length < 16)
131
+ )
132
+ return false;
133
+ const ex = basis.eastX,
134
+ ey = basis.eastY,
135
+ nz = basis.northZ;
136
+ const ux = basis.upX,
137
+ uy = basis.upY,
138
+ uz = basis.upZ;
139
+ const nx = -uz * ey,
140
+ ny = uz * ex;
141
+ const x = origin.x,
142
+ y = origin.y,
143
+ z = origin.z;
144
+ const ax = (a === 1 ? ex : a === 2 ? nx : ux) * Math.sign(first);
145
+ const ay = (a === 1 ? ey : a === 2 ? ny : uy) * Math.sign(first);
146
+ const az = (a === 1 ? 0 : a === 2 ? nz : uz) * Math.sign(first);
147
+ const bx = (b === 1 ? ex : b === 2 ? nx : ux) * Math.sign(second);
148
+ const by = (b === 1 ? ey : b === 2 ? ny : uy) * Math.sign(second);
149
+ const bz = (b === 1 ? 0 : b === 2 ? nz : uz) * Math.sign(second);
150
+ const cx = (c === 1 ? ex : c === 2 ? nx : ux) * Math.sign(third);
151
+ const cy = (c === 1 ? ey : c === 2 ? ny : uy) * Math.sign(third);
152
+ const cz = (c === 1 ? 0 : c === 2 ? nz : uz) * Math.sign(third);
153
+ if (
154
+ !Number.isFinite(ax) ||
155
+ !Number.isFinite(ay) ||
156
+ !Number.isFinite(az) ||
157
+ !Number.isFinite(bx) ||
158
+ !Number.isFinite(by) ||
159
+ !Number.isFinite(bz) ||
160
+ !Number.isFinite(cx) ||
161
+ !Number.isFinite(cy) ||
162
+ !Number.isFinite(cz) ||
163
+ !Number.isFinite(x) ||
164
+ !Number.isFinite(y) ||
165
+ !Number.isFinite(z)
166
+ )
167
+ return false;
168
+ if (
169
+ result instanceof Float32Array &&
170
+ (!Number.isFinite(Math.fround(ax)) ||
171
+ !Number.isFinite(Math.fround(ay)) ||
172
+ !Number.isFinite(Math.fround(az)) ||
173
+ !Number.isFinite(Math.fround(bx)) ||
174
+ !Number.isFinite(Math.fround(by)) ||
175
+ !Number.isFinite(Math.fround(bz)) ||
176
+ !Number.isFinite(Math.fround(cx)) ||
177
+ !Number.isFinite(Math.fround(cy)) ||
178
+ !Number.isFinite(Math.fround(cz)) ||
179
+ !Number.isFinite(Math.fround(x)) ||
180
+ !Number.isFinite(Math.fround(y)) ||
181
+ !Number.isFinite(Math.fround(z)))
182
+ )
183
+ return false;
184
+ // Snapshot every component before application setters can recursively change scratch.
185
+ result[0] = ax;
186
+ result[1] = ay;
187
+ result[2] = az;
188
+ result[3] = 0;
189
+ result[4] = bx;
190
+ result[5] = by;
191
+ result[6] = bz;
192
+ result[7] = 0;
193
+ result[8] = cx;
194
+ result[9] = cy;
195
+ result[10] = cz;
196
+ result[11] = 0;
197
+ result[12] = x;
198
+ result[13] = y;
199
+ result[14] = z;
200
+ result[15] = 1;
201
+ return true;
202
+ }
203
+ function axisCode(axis: LocalFrameAxis): number {
204
+ switch (axis) {
205
+ case 'east':
206
+ return 1;
207
+ case 'west':
208
+ return -1;
209
+ case 'north':
210
+ return 2;
211
+ case 'south':
212
+ return -2;
213
+ case 'up':
214
+ return 3;
215
+ case 'down':
216
+ return -3;
217
+ default:
218
+ return 0;
219
+ }
220
+ }
221
+ function commitBasis(
222
+ result: LocalFrameBasis,
223
+ ex: number,
224
+ ey: number,
225
+ nz: number,
226
+ ux: number,
227
+ uy: number,
228
+ uz: number
229
+ ): boolean {
230
+ if (
231
+ !Number.isFinite(ex) ||
232
+ !Number.isFinite(ey) ||
233
+ !Number.isFinite(nz) ||
234
+ !Number.isFinite(ux) ||
235
+ !Number.isFinite(uy) ||
236
+ !Number.isFinite(uz)
237
+ )
238
+ return false;
239
+ result.eastX = ex;
240
+ result.eastY = ey;
241
+ result.northZ = nz;
242
+ result.upX = ux;
243
+ result.upY = uy;
244
+ result.upZ = uz;
245
+ return true;
246
+ }
247
+ function commitPoint(result: LocalFramePoint, x: number, y: number, z: number): boolean {
248
+ if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z)) return false;
249
+ result.x = x;
250
+ result.y = y;
251
+ result.z = z;
252
+ return true;
253
+ }
package/src/mat3.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  export * from './gl-matrix/mat3';
package/src/mat4.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  export * from './gl-matrix/mat4';
package/src/quat.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  export * from './gl-matrix/quat';