@wemap/maths 10.9.2 → 11.0.0-11.0.0-alpha.11.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 (36) hide show
  1. package/{index.js → index.ts} +2 -1
  2. package/package.json +14 -5
  3. package/src/EulerAngles.ts +10 -0
  4. package/src/{Geometry.js → Geometry.ts} +10 -14
  5. package/src/{Matrix.js → Matrix.ts} +17 -12
  6. package/src/{Matrix3.spec.js → Matrix3.spec.ts} +13 -7
  7. package/src/{Matrix3.js → Matrix3.ts} +46 -21
  8. package/src/Matrix4.spec.ts +187 -0
  9. package/src/Matrix4.ts +302 -0
  10. package/src/{Point2.js → Point2.ts} +4 -2
  11. package/src/{Polygon.spec.js → Polygon.spec.ts} +3 -2
  12. package/src/{Polygon.js → Polygon.ts} +4 -3
  13. package/src/{Quaternion.spec.js → Quaternion.spec.ts} +20 -57
  14. package/src/{Quaternion.js → Quaternion.ts} +32 -31
  15. package/src/{Rotations.spec.js → Rotations.spec.ts} +4 -8
  16. package/src/{Rotations.js → Rotations.ts} +14 -16
  17. package/src/{Utils.spec.js → Utils.spec.ts} +2 -0
  18. package/src/{Utils.js → Utils.ts} +10 -23
  19. package/src/{Vector.spec.js → Vector.spec.ts} +1 -0
  20. package/src/Vector.ts +10 -0
  21. package/src/{Vector3.spec.js → Vector3.spec.ts} +4 -2
  22. package/src/{Vector3.js → Vector3.ts} +11 -10
  23. package/src/types.ts +21 -0
  24. package/tsconfig.json +3 -0
  25. package/vite.config.ts +4 -0
  26. package/dist/wemap-maths.es.js +0 -1100
  27. package/dist/wemap-maths.es.js.map +0 -1
  28. package/index.d.ts +0 -176
  29. package/src/EulerAngles.js +0 -8
  30. package/src/Matrix4.js +0 -158
  31. package/src/Matrix4.spec.js +0 -51
  32. package/src/Transformation.js +0 -40
  33. package/src/Transformation.spec.js +0 -79
  34. package/src/Vector.js +0 -8
  35. /package/src/{Matrix.spec.js → Matrix.spec.ts} +0 -0
  36. /package/src/{Point2.spec.js → Point2.spec.ts} +0 -0
@@ -1,79 +0,0 @@
1
- import chai from 'chai';
2
- import chaiAlmost from 'chai-almost';
3
-
4
- import Matrix3 from './Matrix3.js';
5
- import Matrix4 from './Matrix4.js';
6
- import Transformation from './Transformation.js';
7
-
8
-
9
- const { expect } = chai;
10
- chai.use(chaiAlmost());
11
-
12
- describe('Transformation', () => {
13
-
14
- let t1, t2;
15
- let rot1, tr1, rot2, tr2;
16
-
17
- it('fromPose', () => {
18
- rot1 = Matrix3.rotX(Math.PI / 2);
19
- tr1 = [0, 1, 0];
20
- t1 = Transformation.fromPose(rot1, tr1);
21
- expect(t1).deep.almost([
22
- [1, 0, 0, 0],
23
- [0, 0, -1, 1],
24
- [0, 1, 0, 0],
25
- [0, 0, 0, 1]
26
- ]);
27
-
28
- rot2 = Matrix3.multiply(rot1, Matrix3.rotZ(Math.PI / 2));
29
- tr2 = [2, 1, 0];
30
- t2 = Transformation.fromPose(rot2, tr2);
31
- expect(t2).deep.almost([
32
- [0, -1, 0, 2],
33
- [0, 0, -1, 1],
34
- [-1, 0, 0, 0],
35
- [0, 0, 0, 1]
36
- ]);
37
- });
38
-
39
- it('extractRotation', () => {
40
- expect(Transformation.extractRotation(t1)).deep.almost(rot1);
41
- expect(Transformation.extractRotation(t2)).deep.almost(rot2);
42
- });
43
-
44
- it('extractTranslation', () => {
45
- expect(Transformation.extractTranslation(t1)).deep.almost(tr1);
46
- expect(Transformation.extractTranslation(t2)).deep.almost(tr2);
47
- });
48
-
49
- it('invert', () => {
50
- expect(Transformation.invert(t1)).deep.almost([
51
- [1, 0, 0, 0],
52
- [0, 0, 1, 0],
53
- [0, -1, 0, 1],
54
- [0, 0, 0, 1]
55
- ]);
56
-
57
- expect(Transformation.invert(t2)).deep.almost([
58
- [0, 0, -1, 0],
59
- [-1, 0, 0, 2],
60
- [0, -1, 0, 1],
61
- [0, 0, 0, 1]
62
- ]);
63
-
64
- const tr3 = Transformation.scaleScalar(
65
- Transformation.fromPose(
66
- Matrix3.rotY(Math.PI / 2),
67
- [1, 2, 3]
68
- ), 2);
69
- const invertTr3 = Transformation.invert(tr3);
70
- expect(invertTr3).deep.almost([
71
- [0, 0, -1, 6],
72
- [0, 1, 0, -4],
73
- [1, 0, 0, -2],
74
- [0, 0, 0, 2]
75
- ]);
76
- expect(Matrix4.multiply(tr3, invertTr3)).deep.almost(Matrix4.identity);
77
- });
78
-
79
- });
package/src/Vector.js DELETED
@@ -1,8 +0,0 @@
1
- class Vector {
2
-
3
- static concat(v1, v2) {
4
- return v1.concat(v2);
5
- }
6
- }
7
-
8
- export default Vector;
File without changes
File without changes