@lijuhong1981/jsmath 1.0.10 → 1.0.12

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 CHANGED
@@ -12,6 +12,8 @@ import {
12
12
  DEGREES_PER_RADIAN,
13
13
  RADIANS_PER_ARCSECOND
14
14
  } from "./src/Constant.js";
15
+ import degToRad from "./src/degToRad.js";
16
+ import radToDeg from "./src/radToDeg.js";
15
17
  import clamp from "./src/clamp.js";
16
18
  import clampLatitude from "./src/clampLatitude.js";
17
19
  import clampLongitude from "./src/clampLongitude.js";
@@ -41,6 +43,8 @@ export {
41
43
  RADIANS_PER_DEGREE,
42
44
  DEGREES_PER_RADIAN,
43
45
  RADIANS_PER_ARCSECOND,
46
+ degToRad,
47
+ radToDeg,
44
48
  clamp,
45
49
  clampLatitude,
46
50
  clampLongitude,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lijuhong1981/jsmath",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -19,6 +19,6 @@
19
19
  },
20
20
  "homepage": "https://github.com/lijuhong1981/jsmath#readme",
21
21
  "dependencies": {
22
- "@lijuhong1981/jscheck": "^1.0.1"
22
+ "@lijuhong1981/jscheck": "^1.0.4"
23
23
  }
24
24
  }
package/src/Range.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import Check from "@lijuhong1981/jscheck";
2
2
  import isBetween from "./isBetween.js";
3
3
  import lerp from "./lerp.js";
4
- import percentInRange from "./percentInRange.js";
4
+ import scalarInRange from "./scalarInRange.js";
5
5
 
6
6
  function checkMinMaxValue(range) {
7
7
  if (range.minimum > range.maximum) {
@@ -100,13 +100,13 @@ class Range {
100
100
  }
101
101
 
102
102
  /**
103
- * 计算一个数值在当前区间内的线性插值百分比
103
+ * 计算一个数值在当前区间内的线性插值标量
104
104
  * @param {Number} value 需要计算的数值
105
105
  * @param {Boolean} needClamp 是否需要约束至0到1之间,默认true
106
- * @returns {Number} 百分比
106
+ * @returns {Number} 插值标量
107
107
  */
108
- percent(value, needClamp = true) {
109
- return percentInRange(value, this.minimum, this.maximum, needClamp);
108
+ scalar(value, needClamp = true) {
109
+ return scalarInRange(value, this.minimum, this.maximum, needClamp);
110
110
  }
111
111
 
112
112
  /**
@@ -0,0 +1,14 @@
1
+ import Check from "@lijuhong1981/jscheck";
2
+ import { RADIANS_PER_DEGREE } from "./Constant.js";
3
+
4
+ /**
5
+ * 角度转弧度
6
+ * @param {Number} degrees 角度
7
+ * @returns {Number} 弧度
8
+ */
9
+ function degToRad(degrees) {
10
+ Check.typeOf.number('degrees', degrees);
11
+ return degrees * RADIANS_PER_DEGREE;
12
+ };
13
+
14
+ export default degToRad;
@@ -0,0 +1,14 @@
1
+ import Check from "@lijuhong1981/jscheck";
2
+ import { DEGREES_PER_RADIAN } from "./Constant";
3
+
4
+ /**
5
+ * 弧度转角度
6
+ * @param {Number} radians 弧度
7
+ * @returns {Number} 角度
8
+ */
9
+ function radToDeg(radians) {
10
+ Check.typeOf.number('radians', radians);
11
+ return radians * DEGREES_PER_RADIAN;
12
+ }
13
+
14
+ export default radToDeg;