Members
弧度以弧度表示的度数。
0.1
0.01
0.001
0.0001
0.00001
0.000001
0.0000001
0.00000001
0.000000001
0.0000000001
0.00000000001
0.000000000001
0.0000000000001
0.00000000000001
0.000000000000001
0.0000000000000001
0
0.000000000000000001
0.0000000000000000001
0.00000000000000000001
0.000000000000000000001
4*1024*1024*1024
以米为单位的地球引力参数
WGS84型号定义的每秒平方:3.986004418e14
月球的平均半径
地图坐标和行星和卫星的旋转元素:2000年“,
天体力学82:83-1102002。
1/π
1/2磅
圆周率
圆周率/4
圆周率/6
圆周率/3
π/2
弧度一弧度秒中的弧度数。
以度表示的弧度数。
64*1024
太阳半径(米):6.955e8
3便士/2
2磅
Methods
计算
Math.acos(value)
,但首先将value
钳制到范围[-1.0,1.0]
所以函数永远不会返回NaN。Name | Type | Description |
---|---|---|
value |
Number | 计算ACO的值。 |
Returns:
如果值在[-1.0,1.0]或-1.0或1.0的ACO范围内,则值的ACO,
如果值超出范围,则以较近者为准。
计算
Math.asin(value)
,但首先将value
钳制到范围[-1.0,1.0]
所以函数永远不会返回NaN。Name | Type | Description |
---|---|---|
value |
Number | 要计算asin的值。 |
Returns:
如果值在范围[-1.0,1.0]内,则为该值的asin,或-1.0或1.0的asin,
如果值超出范围,则以较接近的为准。
找到
number
的立方根。
如果未提供数字,则返回NaN。Name | Type | Description |
---|---|---|
number |
Number | optional 号码。 |
Returns:
结果。
在给定圆的半径和点之间的角度的情况下,查找两点之间的弦长。
Name | Type | Description |
---|---|---|
angle |
Number | 两点之间的夹角。 |
radius |
Number | 圆的半径。 |
Returns:
弦长。
约束一个介于两个值之间的值。
Name | Type | Description |
---|---|---|
value |
Number | 要约束的值。 |
min |
Number | 最小值。 |
max |
Number | 最大值。 |
Returns:
钳制值,使最小值<=值<=最大值。
方便函数,它将纬度值(以弧度为单位)固定到范围[
-Math.PI/2
、Math.PI/2
)。
用于在需要正确范围的对象中使用之前对数据进行清理。Name | Type | Description |
---|---|---|
angle |
Number | 要钳制到范围[-Math.PI/2 、Math.PI/2 )的纬度值(以弧度为单位)。 |
Returns:
纬度值固定在范围[
-Math.PI/2
、Math.PI/2
)。Example:
// Clamp 108 degrees latitude to 90 degrees latitude
var latitude = Cesium.Math.clampToLatitudeRange(Cesium.Math.toRadians(108.0));
将以弧度为单位的经度值转换为范围[
-Math.PI
,Math.PI
)。Name | Type | Description |
---|---|---|
angle |
Number | 要转换为范围[-Math.PI ,Math.PI )的经度值(以弧度为单位)。 |
Returns:
范围[
-Math.PI
,Math.PI
)中的等效经度值。Example:
// Convert 270 degrees to -90 degrees longitude
var longitude = Cesium.Math.convertLongitudeRange(Cesium.Math.toRadians(270.0));
re转换一个数字的双曲余弦。
双曲余弦value定义为
(ex + e-x)/2.0
其中e是欧拉数,约为2.71828183。
Special cases:
- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is positive infinity.
- If the argument is zero, then the result is 1.0.
Name | Type | Description |
---|---|---|
value |
Number | 要返回其双曲余弦的数字。 |
Returns:
双曲余弦为
value
。使用绝对或相对公差测试确定两个值是否相等。这很有用
以避免在直接比较浮点值时由于舍入误差而产生的问题。价值观是
首先用绝对公差试验进行比较。如果失败,则进行相对公差测试。
如果您不确定左右的大小,请使用此测试。
Name | Type | Default | Description |
---|---|---|---|
left |
Number | 要比较的第一个值。 | |
right |
Number | 要比较的另一个值。 | |
relativeEpsilon |
Number |
0
|
optional
相对公差试验left 和right 之间的最大包含增量。 |
absoluteEpsilon |
Number |
relativeEpsilon
|
optional
绝对公差试验left 和right 之间的最大包含增量。 |
Returns:
如果值在epsilon内相等,则为
true
;否则为false
。Example:
var a = Cesium.Math.equalsEpsilon(0.0, 0.01, Cesium.Math.EPSILON2); // true
var b = Cesium.Math.equalsEpsilon(0.0, 0.1, Cesium.Math.EPSILON2); // false
var c = Cesium.Math.equalsEpsilon(3699175.1634344, 3699175.2, Cesium.Math.EPSILON7); // true
var d = Cesium.Math.equalsEpsilon(3699175.1634344, 3699175.2, Cesium.Math.EPSILON9); // false
计算所提供数的阶乘。
Name | Type | Description |
---|---|---|
n |
Number | 要计算其阶乘的数。 |
Returns:
如果未定义的数小于0,则提供该数。
Throws:
-
DeveloperError :需要大于或等于0的数字。
Example:
//Compute 7!, which is equal to 5040
var computedFactorial = Cesium.Math.factorial(7);
See:
计算输入在[-1,1]范围内的Atan的快速近似值。
基于Michal Drobot从ShaderFastLibs得到的近似值,
这又是基于“反正切函数的有效近似”
Rajan,S.Sichun Wang Inkol,R.Joyal,A.,2006年5月。
改编自麻省理工学院授权的ShaderFastLibs。
Name | Type | Description |
---|---|---|
x |
Number | 范围为[-1,1]的输入数字 |
Returns:
atan(x)的一个近似
计算任意输入标量的Atan2(x,y)的快速近似值。
基于nvidia cg参考实现的距离缩小数学:http://developer.download.nvidia.com/cg/atan2.html
Name | Type | Description |
---|---|---|
x |
Number | 如果y为零则不为零的输入数。 |
y |
Number | 如果x为零,则为非零的输入数。 |
Returns:
atan2(x,y)的近似值
将范围[0,rangeMaximum]内的SNORM值转换为范围[-1.0,1.0]的标量。
Name | Type | Default | Description |
---|---|---|---|
value |
Number | 范围[0,rangeMaximum]内的SNORM值 | |
rangeMaximum |
Number |
255
|
optional snom范围内的最大值,默认为255。 |
Returns:
范围为[-1.0,1.0]的标量。
- CesiumMath.toSNorm
See:
确定左值是否大于右值。如果这两个值在
它们被视为相等,此函数返回false。
Name | Type | Description |
---|---|---|
left |
Number | 要比较的第一个数字。 |
right |
Number | 要比较的第二个数字。 |
absoluteEpsilon |
Number | 用于比较的绝对epsilon。 |
Returns:
true
如果left
大于right
absoluteEpsilon. false
if left
is less or if the two
values are nearly equal.
确定左值是否大于或等于右值。如果两个值在
absoluteEpsilon
彼此,它们被认为是相等的,并且该函数返回true。
Name
Type
Description
left
Number
要比较的第一个数字。
right
Number
要比较的第二个数字。
absoluteEpsilon
Number
用于比较的绝对epsilon。
Returns:
如果left
大于right
或
这些值几乎相等。
如果数字超过最大值,则将带换行符的数字增加到最小值。
Name
Type
Default
Description
n
Number
optional
要递增的数字。
maximumValue
Number
optional
在滚动到最小值之前的最大增量值。
minimumValue
Number
0.0
optional
超过最大值后,数字重置为。
Returns:
递增的数字。
Throws:
-
DeveloperError
:最大值必须大于最小值。
Example:
var n = Cesium.Math.incrementWrap(5, 10, 0); // returns 6
var n = Cesium.Math.incrementWrap(10, 10, 0); // returns 0
确定正整数是否为2的幂。
Name
Type
Description
n
Number
要测试的正整数。
Returns:
如果数字是2的幂,则为true
;否则为false
。
Throws:
-
DeveloperError
:需要大于或等于0的数字。
Example:
var t = Cesium.Math.isPowerOfTwo(16); // true
var f = Cesium.Math.isPowerOfTwo(20); // false
两个线性插值计算两个值。
Name
Type
Description
p
Number
要插值的起始值。
q
Number
要插值的结束值。
time
Number
插值时间一般在[0.0, 1.0]
范围内。
Returns:
线性插值值。
Example:
var n = Cesium.Math.lerp(0.0, 2.0, 0.5); // returns 1.0
确定左值是否小于右值。如果这两个值在
它们被视为相等,此函数返回false。
Name
Type
Description
left
Number
要比较的第一个数字。
right
Number
要比较的第二个数字。
absoluteEpsilon
Number
用于比较的绝对epsilon。
Returns:
如果left
小于right
大于616668167,则为true
absoluteEpsilon. false
if left
is greater or if the two
values are nearly equal.
确定左值是否小于或等于右值。如果这两个值在
它们被视为相等,此函数返回true。
Name
Type
Description
left
Number
要比较的第一个数字。
right
Number
要比较的第二个数字。
absoluteEpsilon
Number
用于比较的绝对epsilon。
Returns:
如果left
小于right
或
这些值几乎相等。
求一个数以2为底的对数。
Name
Type
Description
number
Number
号码。
Returns:
结果。
查找数字对基的对数。
Name
Type
Description
number
Number
号码。
base
Number
基地。
Returns:
结果。
也适用于负红利的模运算。
Name
Type
Description
m
Number
股息。
n
Number
除数。
Returns:
剩下的。
生成范围为-Pi<=angle<=Pi的角度,该角度与提供的角度相等。
Name
Type
Description
angle
Number
以弧度表示
Returns:
范围内的角度[-CesiumMath.PI
,CesiumMath.PI
]。
计算大于或等于所提供正整数的两个整数的下一次幂。
Name
Type
Description
n
Number
要测试的正整数。
Returns:
两个整数的下一次幂。
Throws:
-
DeveloperError
:需要大于或等于0的数字。
Example:
var n = Cesium.Math.nextPowerOfTwo(29); // 32
var m = Cesium.Math.nextPowerOfTwo(32); // 32
生成范围为[0.0,1.0)的随机浮点数
用梅森捻线器。
Returns:
在[0.0,1.0)范围内的随机数。
See:
- CesiumMath.setRandomNumberSeed
- Mersenne twister on Wikipedia
将范围[rangeMinimum,rangeMaximum]中的标量值转换为范围[0.0,1.0]中的标量值
Name
Type
Description
value
Number
范围[rangeMinimum,rangeMaximum]中的标量值
rangeMinimum
Number
映射范围中的最小值。
rangeMaximum
Number
映射范围中的最大值。
Returns:
标量值,其中rangeMinimum映射为0.0,rangeMaximum映射为1.0。
在两个数字之间生成一个随机数。
Name
Type
Description
min
Number
最小值。
max
Number
最大值。
Returns:
最小值和最大值之间的随机数。
设置随机数生成器使用的种子
在CesiumMath#nextRandomNumber
。
Name
Type
Description
seed
Number
用作种子的整数。
返回值的符号;如果值为正,则返回1;如果值为正,则返回-1
负值,如果值为0,则为0。
Name
Type
Description
value
Number
返回符号的值。
Returns:
价值的象征。
如果给定值为正或零,则返回1.0;如果给定值为负,则返回-1.0。
这与CesiumMath#sign
类似,只是返回1.0而不是
输入值为0.0时为0.0。
Name
Type
Description
value
Number
返回符号的值。
Returns:
价值的象征。
re旋转数字的双曲正弦。
value的双曲正弦定义为
(ex - e-x)/2.0
其中e是欧拉数,约为2.71828183。
Special cases:
- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is an infinity
with the same sign as the argument.
- If the argument is zero, then the result is a zero with the
same sign as the argument.
Name
Type
Description
value
Number
要返回其双曲正弦值的数字。
Returns:
value
的双曲正弦。
将弧度转换为度。
Name
Type
Description
radians
Number
要转换为弧度的角度。
Returns:
以度为单位的相应角度。
将度数转换为弧度。
Name
Type
Description
degrees
Number
要转换的角度(以度为单位)。
Returns:
以弧度表示的相应角度。
将范围为[-1.0,1.0]的标量值转换为范围[0,rangeMaximum]的SNORM
Name
Type
Default
Description
value
Number
范围[-1.0,1.0]中的标量值
rangeMaximum
Number
255
optional
映射范围中的最大值,默认为255。
Returns:
一个SNORM值,其中0映射到-1.0,rangeMaximum映射到1.0。
See:
- CesiumMath.fromSNorm
生成范围为0<=angle<=2Pi的角度,该角度与提供的角度相等。
Name
Type
Description
angle
Number
以弧度表示
Returns:
在[0CesiumMath.TWO_PI
]范围内的角度。