@wemap/maths 3.1.14 → 3.2.1
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.
- package/index.js +10 -10
- package/package.json +4 -5
- package/src/Matrix.spec.js +4 -2
- package/src/Matrix3.js +1 -1
- package/src/Matrix3.spec.js +2 -2
- package/src/Matrix4.js +1 -1
- package/src/Matrix4.spec.js +4 -2
- package/src/Polygon.js +1 -1
- package/src/Quaternion.js +1 -1
- package/src/Quaternion.spec.js +3 -3
- package/src/Rotations.js +3 -3
- package/src/Rotations.spec.js +2 -2
- package/src/Utils.spec.js +2 -2
- package/src/Vector.spec.js +4 -2
- package/src/Vector3.js +1 -1
- package/src/Vector3.spec.js +3 -2
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Matrix from './src/Matrix';
|
|
2
|
-
import Matrix3 from './src/Matrix3';
|
|
3
|
-
import Matrix4 from './src/Matrix4';
|
|
4
|
-
import Point2 from './src/Point2';
|
|
5
|
-
import Polygon from './src/Polygon';
|
|
6
|
-
import Quaternion from './src/Quaternion';
|
|
7
|
-
import Rotations from './src/Rotations';
|
|
8
|
-
import Utils from './src/Utils';
|
|
9
|
-
import Vector from './src/Vector';
|
|
10
|
-
import Vector3 from './src/Vector3';
|
|
1
|
+
import Matrix from './src/Matrix.js';
|
|
2
|
+
import Matrix3 from './src/Matrix3.js';
|
|
3
|
+
import Matrix4 from './src/Matrix4.js';
|
|
4
|
+
import Point2 from './src/Point2.js';
|
|
5
|
+
import Polygon from './src/Polygon.js';
|
|
6
|
+
import Quaternion from './src/Quaternion.js';
|
|
7
|
+
import Rotations from './src/Rotations.js';
|
|
8
|
+
import Utils from './src/Utils.js';
|
|
9
|
+
import Vector from './src/Vector.js';
|
|
10
|
+
import Vector3 from './src/Vector3.js';
|
|
11
11
|
|
|
12
12
|
const {
|
|
13
13
|
deg2rad, diffAngle, positiveMod, rad2deg
|
package/package.json
CHANGED
|
@@ -12,19 +12,18 @@
|
|
|
12
12
|
"directory": "packages/maths"
|
|
13
13
|
},
|
|
14
14
|
"name": "@wemap/maths",
|
|
15
|
-
"version": "3.1
|
|
15
|
+
"version": "3.2.1",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/wemap/wemap-modules-js#readme",
|
|
20
|
-
"scripts": {
|
|
21
|
-
|
|
22
|
-
},
|
|
20
|
+
"scripts": {},
|
|
21
|
+
"type": "module",
|
|
23
22
|
"keywords": [
|
|
24
23
|
"utils",
|
|
25
24
|
"maths",
|
|
26
25
|
"wemap"
|
|
27
26
|
],
|
|
28
27
|
"license": "ISC",
|
|
29
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "0d430815358a23068c8473b2c310b2945667b2c1"
|
|
30
29
|
}
|
package/src/Matrix.spec.js
CHANGED
package/src/Matrix3.js
CHANGED
package/src/Matrix3.spec.js
CHANGED
package/src/Matrix4.js
CHANGED
package/src/Matrix4.spec.js
CHANGED
package/src/Polygon.js
CHANGED
package/src/Quaternion.js
CHANGED
package/src/Quaternion.spec.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import chai from 'chai';
|
|
2
2
|
import chaiAlmost from 'chai-almost';
|
|
3
3
|
|
|
4
|
-
import Quaternion from './Quaternion';
|
|
5
|
-
import Vector3 from './Vector3';
|
|
4
|
+
import Quaternion from './Quaternion.js';
|
|
5
|
+
import Vector3 from './Vector3.js';
|
|
6
6
|
|
|
7
|
-
const expect = chai
|
|
7
|
+
const { expect } = chai;
|
|
8
8
|
chai.use(chaiAlmost());
|
|
9
9
|
|
|
10
10
|
const q1 = [0.182574185835055, 0.365148371670111, 0.547722557505166, 0.730296743340221];
|
package/src/Rotations.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Utils from './Utils';
|
|
1
|
+
import Utils from './Utils.js';
|
|
2
2
|
|
|
3
3
|
class Rotations {
|
|
4
4
|
|
|
@@ -87,7 +87,7 @@ class Rotations {
|
|
|
87
87
|
const qyqz = qy * qz;
|
|
88
88
|
const qxqx = qx ** 2;
|
|
89
89
|
|
|
90
|
-
if (Math.asin(2 * qwqx + qyqz) < Math.PI / 4 && (qxqx + qy ** 2) < 0.5) {
|
|
90
|
+
if (Math.asin(2 * (qwqx + qyqz)) < Math.PI / 4 && (qxqx + qy ** 2) < 0.5) {
|
|
91
91
|
// Map version
|
|
92
92
|
return - Math.atan2(qw * qz - qx * qy, 0.5 - qxqx - qz ** 2);
|
|
93
93
|
}
|
|
@@ -96,7 +96,7 @@ class Rotations {
|
|
|
96
96
|
|
|
97
97
|
// // ---- Not optimized version ----
|
|
98
98
|
// const eulerAngles = Rotations.quaternionToEulerZXY(quaternion);
|
|
99
|
-
// const eulerAnglesAR = Rotations.quaternionToEulerZXY(Quaternion.multiply(quaternion,
|
|
99
|
+
// const eulerAnglesAR = Rotations.quaternionToEulerZXY(Quaternion.multiply(quaternion, Quaternion.fromAxisAngle([1, 0, 0], - Math.PI / 2)));
|
|
100
100
|
|
|
101
101
|
// if (eulerAngles[1] < Math.PI / 4 && eulerAnglesAR[1] < 0) {
|
|
102
102
|
// return -eulerAngles[0];
|
package/src/Rotations.spec.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chai from 'chai';
|
|
2
2
|
import chaiAlmost from 'chai-almost';
|
|
3
3
|
|
|
4
|
-
import Rotations from './Rotations';
|
|
4
|
+
import Rotations from './Rotations.js';
|
|
5
5
|
|
|
6
|
-
const expect = chai
|
|
6
|
+
const { expect } = chai;
|
|
7
7
|
chai.use(chaiAlmost());
|
|
8
8
|
|
|
9
9
|
const q1 = [0.182574185835055, 0.365148371670111, 0.547722557505166, 0.730296743340221];
|
package/src/Utils.spec.js
CHANGED
package/src/Vector.spec.js
CHANGED
package/src/Vector3.js
CHANGED