@lijuhong1981/jsmath 1.0.11 → 1.0.13
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 +45 -1
- package/package.json +2 -2
- package/src/Constant.js +169 -1
- package/src/Range.js +5 -5
- package/src/equalsEpsilon.js +10 -0
package/index.js
CHANGED
|
@@ -10,7 +10,28 @@ import {
|
|
|
10
10
|
ONE_OVER_TWO_PI,
|
|
11
11
|
RADIANS_PER_DEGREE,
|
|
12
12
|
DEGREES_PER_RADIAN,
|
|
13
|
-
RADIANS_PER_ARCSECOND
|
|
13
|
+
RADIANS_PER_ARCSECOND,
|
|
14
|
+
EPSILON1,
|
|
15
|
+
EPSILON2,
|
|
16
|
+
EPSILON3,
|
|
17
|
+
EPSILON4,
|
|
18
|
+
EPSILON5,
|
|
19
|
+
EPSILON6,
|
|
20
|
+
EPSILON7,
|
|
21
|
+
EPSILON8,
|
|
22
|
+
EPSILON9,
|
|
23
|
+
EPSILON10,
|
|
24
|
+
EPSILON11,
|
|
25
|
+
EPSILON12,
|
|
26
|
+
EPSILON13,
|
|
27
|
+
EPSILON14,
|
|
28
|
+
EPSILON15,
|
|
29
|
+
EPSILON16,
|
|
30
|
+
EPSILON17,
|
|
31
|
+
EPSILON18,
|
|
32
|
+
EPSILON19,
|
|
33
|
+
EPSILON20,
|
|
34
|
+
EPSILON21,
|
|
14
35
|
} from "./src/Constant.js";
|
|
15
36
|
import degToRad from "./src/degToRad.js";
|
|
16
37
|
import radToDeg from "./src/radToDeg.js";
|
|
@@ -22,6 +43,7 @@ import convertToDegreesCircular from "./src/convertToDegreesCircular .js";
|
|
|
22
43
|
import convertToRadiansCircular from "./src/convertToRadiansCircular.js";
|
|
23
44
|
import convertToLatitudeRange from "./src/convertToLatitudeRange.js";
|
|
24
45
|
import convertToLongitudeRange from "./src/convertToLongitudeRange.js";
|
|
46
|
+
import equalsEpsilon from "./src/equalsEpsilon.js";
|
|
25
47
|
import isBetween from "./src/isBetween.js";
|
|
26
48
|
import lerp from "./src/lerp.js";
|
|
27
49
|
import scalarInRange from "./src/scalarInRange.js";
|
|
@@ -43,6 +65,27 @@ export {
|
|
|
43
65
|
RADIANS_PER_DEGREE,
|
|
44
66
|
DEGREES_PER_RADIAN,
|
|
45
67
|
RADIANS_PER_ARCSECOND,
|
|
68
|
+
EPSILON1,
|
|
69
|
+
EPSILON2,
|
|
70
|
+
EPSILON3,
|
|
71
|
+
EPSILON4,
|
|
72
|
+
EPSILON5,
|
|
73
|
+
EPSILON6,
|
|
74
|
+
EPSILON7,
|
|
75
|
+
EPSILON8,
|
|
76
|
+
EPSILON9,
|
|
77
|
+
EPSILON10,
|
|
78
|
+
EPSILON11,
|
|
79
|
+
EPSILON12,
|
|
80
|
+
EPSILON13,
|
|
81
|
+
EPSILON14,
|
|
82
|
+
EPSILON15,
|
|
83
|
+
EPSILON16,
|
|
84
|
+
EPSILON17,
|
|
85
|
+
EPSILON18,
|
|
86
|
+
EPSILON19,
|
|
87
|
+
EPSILON20,
|
|
88
|
+
EPSILON21,
|
|
46
89
|
degToRad,
|
|
47
90
|
radToDeg,
|
|
48
91
|
clamp,
|
|
@@ -53,6 +96,7 @@ export {
|
|
|
53
96
|
convertToRadiansCircular,
|
|
54
97
|
convertToLatitudeRange,
|
|
55
98
|
convertToLongitudeRange,
|
|
99
|
+
equalsEpsilon,
|
|
56
100
|
isBetween,
|
|
57
101
|
lerp,
|
|
58
102
|
scalarInRange,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lijuhong1981/jsmath",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
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.
|
|
22
|
+
"@lijuhong1981/jscheck": "^1.0.4"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/src/Constant.js
CHANGED
|
@@ -11,6 +11,153 @@ const RADIANS_PER_DEGREE = PI / 180.0;
|
|
|
11
11
|
const DEGREES_PER_RADIAN = 180.0 / PI;
|
|
12
12
|
const RADIANS_PER_ARCSECOND = RADIANS_PER_DEGREE / 3600.0;
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* 0.1
|
|
16
|
+
* @type {Number}
|
|
17
|
+
* @constant
|
|
18
|
+
*/
|
|
19
|
+
const EPSILON1 = 0.1;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 0.01
|
|
23
|
+
* @type {Number}
|
|
24
|
+
* @constant
|
|
25
|
+
*/
|
|
26
|
+
const EPSILON2 = 0.01;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 0.001
|
|
30
|
+
* @type {Number}
|
|
31
|
+
* @constant
|
|
32
|
+
*/
|
|
33
|
+
const EPSILON3 = 0.001;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 0.0001
|
|
37
|
+
* @type {Number}
|
|
38
|
+
* @constant
|
|
39
|
+
*/
|
|
40
|
+
const EPSILON4 = 0.0001;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 0.00001
|
|
44
|
+
* @type {Number}
|
|
45
|
+
* @constant
|
|
46
|
+
*/
|
|
47
|
+
const EPSILON5 = 0.00001;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 0.000001
|
|
51
|
+
* @type {Number}
|
|
52
|
+
* @constant
|
|
53
|
+
*/
|
|
54
|
+
const EPSILON6 = 0.000001;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 0.0000001
|
|
58
|
+
* @type {Number}
|
|
59
|
+
* @constant
|
|
60
|
+
*/
|
|
61
|
+
const EPSILON7 = 0.0000001;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 0.00000001
|
|
65
|
+
* @type {Number}
|
|
66
|
+
* @constant
|
|
67
|
+
*/
|
|
68
|
+
const EPSILON8 = 0.00000001;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 0.000000001
|
|
72
|
+
* @type {Number}
|
|
73
|
+
* @constant
|
|
74
|
+
*/
|
|
75
|
+
const EPSILON9 = 0.000000001;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 0.0000000001
|
|
79
|
+
* @type {Number}
|
|
80
|
+
* @constant
|
|
81
|
+
*/
|
|
82
|
+
const EPSILON10 = 0.0000000001;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 0.00000000001
|
|
86
|
+
* @type {Number}
|
|
87
|
+
* @constant
|
|
88
|
+
*/
|
|
89
|
+
const EPSILON11 = 0.00000000001;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 0.000000000001
|
|
93
|
+
* @type {Number}
|
|
94
|
+
* @constant
|
|
95
|
+
*/
|
|
96
|
+
const EPSILON12 = 0.000000000001;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 0.0000000000001
|
|
100
|
+
* @type {Number}
|
|
101
|
+
* @constant
|
|
102
|
+
*/
|
|
103
|
+
const EPSILON13 = 0.0000000000001;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 0.00000000000001
|
|
107
|
+
* @type {Number}
|
|
108
|
+
* @constant
|
|
109
|
+
*/
|
|
110
|
+
const EPSILON14 = 0.00000000000001;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 0.000000000000001
|
|
114
|
+
* @type {Number}
|
|
115
|
+
* @constant
|
|
116
|
+
*/
|
|
117
|
+
const EPSILON15 = 0.000000000000001;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 0.0000000000000001
|
|
121
|
+
* @type {Number}
|
|
122
|
+
* @constant
|
|
123
|
+
*/
|
|
124
|
+
const EPSILON16 = 0.0000000000000001;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 0.00000000000000001
|
|
128
|
+
* @type {Number}
|
|
129
|
+
* @constant
|
|
130
|
+
*/
|
|
131
|
+
const EPSILON17 = 0.00000000000000001;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 0.000000000000000001
|
|
135
|
+
* @type {Number}
|
|
136
|
+
* @constant
|
|
137
|
+
*/
|
|
138
|
+
const EPSILON18 = 0.000000000000000001;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 0.0000000000000000001
|
|
142
|
+
* @type {Number}
|
|
143
|
+
* @constant
|
|
144
|
+
*/
|
|
145
|
+
const EPSILON19 = 0.0000000000000000001;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 0.00000000000000000001
|
|
149
|
+
* @type {Number}
|
|
150
|
+
* @constant
|
|
151
|
+
*/
|
|
152
|
+
const EPSILON20 = 0.00000000000000000001;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 0.000000000000000000001
|
|
156
|
+
* @type {Number}
|
|
157
|
+
* @constant
|
|
158
|
+
*/
|
|
159
|
+
const EPSILON21 = 0.000000000000000000001;
|
|
160
|
+
|
|
14
161
|
export {
|
|
15
162
|
PI,
|
|
16
163
|
ONE_OVER_PI,
|
|
@@ -23,5 +170,26 @@ export {
|
|
|
23
170
|
ONE_OVER_TWO_PI,
|
|
24
171
|
RADIANS_PER_DEGREE,
|
|
25
172
|
DEGREES_PER_RADIAN,
|
|
26
|
-
RADIANS_PER_ARCSECOND
|
|
173
|
+
RADIANS_PER_ARCSECOND,
|
|
174
|
+
EPSILON1,
|
|
175
|
+
EPSILON2,
|
|
176
|
+
EPSILON3,
|
|
177
|
+
EPSILON4,
|
|
178
|
+
EPSILON5,
|
|
179
|
+
EPSILON6,
|
|
180
|
+
EPSILON7,
|
|
181
|
+
EPSILON8,
|
|
182
|
+
EPSILON9,
|
|
183
|
+
EPSILON10,
|
|
184
|
+
EPSILON11,
|
|
185
|
+
EPSILON12,
|
|
186
|
+
EPSILON13,
|
|
187
|
+
EPSILON14,
|
|
188
|
+
EPSILON15,
|
|
189
|
+
EPSILON16,
|
|
190
|
+
EPSILON17,
|
|
191
|
+
EPSILON18,
|
|
192
|
+
EPSILON19,
|
|
193
|
+
EPSILON20,
|
|
194
|
+
EPSILON21,
|
|
27
195
|
};
|
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
|
|
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
|
-
|
|
109
|
-
return
|
|
108
|
+
scalar(value, needClamp = true) {
|
|
109
|
+
return scalarInRange(value, this.minimum, this.maximum, needClamp);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|