@wemap/maths 0.1.3 → 0.2.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/Utils.js +9 -4
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/maths"
13
13
  },
14
14
  "name": "@wemap/maths",
15
- "version": "0.1.3",
15
+ "version": "0.2.0",
16
16
  "bugs": {
17
17
  "url": "https://github.com/wemap/wemap-utils-js/issues"
18
18
  },
@@ -26,5 +26,5 @@
26
26
  "wemap"
27
27
  ],
28
28
  "license": "ISC",
29
- "gitHead": "5a6cf9f90b3efd8b97e6c232a012bfc057b036ea"
29
+ "gitHead": "6673bc4d0f4b6ff404534e0642122c340fe58483"
30
30
  }
package/src/Utils.js CHANGED
@@ -1,7 +1,4 @@
1
- /**
2
- * [MathUtils description]
3
- * @type {Object}
4
- */
1
+
5
2
  class Utils {
6
3
 
7
4
  /**
@@ -17,10 +14,18 @@ class Utils {
17
14
  return rad * 180 / Math.PI;
18
15
  }
19
16
 
17
+ /**
18
+ * Difference between two angles
19
+ * @param {Number} angle1 in radians
20
+ * @param {Number} angle2 in radians
21
+ */
20
22
  static diffAngle(angle1, angle2) {
21
23
  return (angle1 - angle2 + Math.PI) % (2 * Math.PI) - Math.PI;
22
24
  }
23
25
 
26
+ static positiveMod(n, m) {
27
+ return ((n % m) + m) % m;
28
+ }
24
29
  }
25
30
 
26
31
  export default Utils;