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.00000000000000001
0.000000000000000001
0.0000000000000000001
0.00000000000000000001
0.000000000000000000001
4 * 1024 * 1024 * 1024
以立方米计的地球引力参数
按 NT 0 型号定义的每秒平方: 3.986004418e14
月球的平均半径,根据" -IAU / -IAG "的报告. 人权委员会
-NT=0=- 翻译: 行星和卫星的坐标和旋转要素:2000年”,
Celestial Mechanics 82: 83-110, 2002.
1/pi
1/2pi
pi
pi/4
pi/6
pi/3
pi/2
弧秒的弧度数.
一个学位的弧度数.
64 * 1024
以米计的太阳半径: 6.955e8
3pi/2
2pi
Methods
Computes
Math.acos(value), but first clamps value to the range [-1.0, 1.0]
这样,函数就永远不会返回NaN.
| Name | Type | Description |
|---|---|---|
value |
number | 计算acos的值. |
Returns:
如果值在 [- 1.0, 1.0] 范围内, 或为 - 1.0 或 1.0 的 cos, 则该值的acos ,
如果值超出范围,则以更接近者为准.
Computes
Math.asin(value), but first clamps value to the range [-1.0, 1.0]
这样,函数就永远不会返回NaN.
| Name | Type | Description |
|---|---|---|
value |
number | 用于计算的价值. |
Returns:
如果值在 [-1.0, 1.0] 或 -1.0 或 1.0 或 1.0 之间,则该值的当量,
如果值超出范围,则以更接近者为准.
查找数字的立方根.
Returns NaN if
number is not provided.
| Name | Type | Description |
|---|---|---|
number |
number | optional The number. |
Returns:
The result.
根据圆的半径和点间的角,在两点之间找到和弦长度.
| Name | Type | Description |
|---|---|---|
angle |
number | 两点之间的角度. |
radius |
number | 圆之半径. |
Returns:
弦长.
限制两个值之间的值.
| Name | Type | Description |
|---|---|---|
value |
number | 夹的值. |
min |
number | 最低值. |
max |
number | 最大值 . |
Returns:
被夹住的值如此小 QQ 结果最大 .
Convenience function that clamps a latitude value, in radians, to the range [
-Math.PI/2, Math.PI/2).
可用于在需要正确范围的物体中使用前对数据进行消毒.
| Name | Type | Description |
|---|---|---|
angle |
number |
The latitude value, in radians, to clamp to the range [-Math.PI/2, Math.PI/2). |
Returns:
The latitude value clamped to the range [
-Math.PI/2, Math.PI/2).
Example:
// Clamp 108 degrees latitude to 90 degrees latitude
const latitude = Cesium.Math.clampToLatitudeRange(Cesium.Math.toRadians(108.0));
Converts a longitude value, in radians, to the range [
-Math.PI, Math.PI).
| Name | Type | Description |
|---|---|---|
angle |
number |
The longitude value, in radians, to convert to the range [-Math.PI, Math.PI). |
Returns:
The equivalent longitude value in the range [
-Math.PI, Math.PI).
Example:
// Convert 270 degrees to -90 degrees longitude
const longitude = Cesium.Math.convertLongitudeRange(Cesium.Math.toRadians(270.0));
返回数字的双曲余弦.
# 值 的双曲余弦被定义为
(ex + e-x)/2.0
其中 NT 0 e NT 1 为欧拉的号码,约为2.7828183.
特殊情况:
- 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:
双曲余弦为 NT 0 值 NT 1 .
使用绝对或相对容忍度测试确定两个值是否相等。 这个有用
以避免直接比较浮点值时出现圆形错误。 数值是
首先用绝对容忍度测试来比较。 如果失败,将进行相对耐受性测试.
如果您不确定左右大小, 请使用此测试 .
| Name | Type | Default | Description |
|---|---|---|---|
left |
number | 第一个比较值. | |
right |
number | 另一个值来比较. | |
relativeEpsilon |
number |
0
|
optional
The maximum inclusive delta between left and right for the relative tolerance test. |
absoluteEpsilon |
number |
相对Epsilon
|
optional
绝对耐受性测试在 左 至 右 之间的最大包容性三角. |
Returns:
如果值在 epsilon 内为等值,则使用 NT 0 true NT 1 ;否则, NT 2 false NT 3 .
Example:
const a = Cesium.Math.equalsEpsilon(0.0, 0.01, Cesium.Math.EPSILON2); // true
const b = Cesium.Math.equalsEpsilon(0.0, 0.1, Cesium.Math.EPSILON2); // false
const c = Cesium.Math.equalsEpsilon(3699175.1634344, 3699175.2, Cesium.Math.EPSILON7); // true
const d = Cesium.Math.equalsEpsilon(3699175.1634344, 3699175.2, Cesium.Math.EPSILON9); // false
计算所提供的数字的因数.
| Name | Type | Description |
|---|---|---|
n |
number | 计算因数的号码. |
Returns:
如果数字小于 0,则提供的数字或未定义的数字的因数.
Throws:
-
DeveloperError : A number greater than or equal to 0 is required.
Example:
//Compute 7!, which is equal to 5040
const computedFactorial = Cesium.Math.factorial(7);
See:
计算Atan在范围[-1,1]中输入的快速近似.
根据Michal Drobot从Shader FastLibs的近似,
它又基于“弧度函数的 有效近似值”
拉詹, S. Sichun Wang Inkol, R. Joyal, A., 2006年5月.
由ShaderFastLibs根据 NT 0 执照.
| Name | Type | Description |
|---|---|---|
x |
number | 范围 [-1, 1] 中的输入编号 |
Returns:
An approximation of atan(x)
计算Atan2(x,y)的快速近似值,用于任意输入scalars.
基于 nvidia 的 cg 引用执行的缩小范围数学 : http://developer.download.nvidia.com/cg/atan2.html
| Name | Type | Description |
|---|---|---|
x |
number | 如果 Y 是 0 , 输入数字不是 0 . |
y |
number | 如果 x 是 0 , 输入数字不是 0 . |
Returns:
An approximation of atan2(x, y)
将位于[0,范围Maximum]范围内的 NT% 0 值转换为位于[-1.0,1.0]范围内的scalar.
| Name | Type | Default | Description |
|---|---|---|---|
value |
number | SNORM value in the range [0, rangeMaximum] | |
rangeMaximum |
number |
255
|
optional 最大值在 NT 0 范围内,默认为255. |
Returns:
射程中的斯卡拉[-1.0,1.0].
- CesiumMath.toSNorm
See:
确定左值是否大于右值。 如果这两个值在其中
absoluteEpsilon of each other, they are considered equal and this function returns false.
| Name | Type | Description |
|---|---|---|
left |
number | 第一个比较的数字. |
right |
number | 第二数相比较. |
absoluteEpsilon |
number | 用于比较的绝对epsilon. |
Returns:
-NT############################################################################################################################################################################################################################################################# 超过
absoluteEpsilon. false if left is less or if the two
价值观几乎是平等的.
确定左值是否大于或等于右值。 如果这两个值都在其中
~
~绝对Epsilon −彼此,它们被认为是平等的,此函数返回为真.
| Name | Type | Description |
|---|---|---|
left |
number | 第一个比较的数字. |
right |
number | 第二数相比较. |
absoluteEpsilon |
number | 用于比较的绝对epsilon. |
Returns:
-NT############################################################################################################################################################################################################################################################# 或如果
价值几乎相等.
如果数字超过最大值,则将数字加起来,并加到最小值.
| Name | Type | Default | Description |
|---|---|---|---|
n |
number | optional 应加之数. | |
maximumValue |
number | optional 滚动到最小值前的最大递增值 . | |
minimumValue |
number |
0.0
|
optional 数字重置到超过最大值后. |
Returns:
递增数.
Throws:
-
DeveloperError : Maximum value must be greater than minimum value.
Example:
const n = Cesium.Math.incrementWrap(5, 10, 0); // returns 6
const m = Cesium.Math.incrementWrap(10, 10, 0); // returns 0
确定非负整数是否为2的功率.
由于Javascript中的32位位位操作者限制,允许输入的最大值为(2^32-1).
| Name | Type | Description |
|---|---|---|
n |
number | 在范围测试的整数 [0], (2^32-1). |
Returns:
NT##0 真 NT####1 如果数字为2;否则, NT 2 假 NT 3 .
Throws:
-
DeveloperError : A number between 0 and (2^32)-1 is required.
Example:
const t = Cesium.Math.isPowerOfTwo(16); // true
const f = Cesium.Math.isPowerOfTwo(20); // false
计算两个值的线性插值.
| Name | Type | Description |
|---|---|---|
p |
number | 插图的起始值 . |
q |
number | 插图的最终值 . |
time |
number | 内插时间一般在 NT 0 [0.0,1.0] NT 1 . |
Returns:
线性插值.
Example:
const n = Cesium.Math.lerp(0.0, 2.0, 0.5); // returns 1.0
确定左值是否小于右值。 如果这两个值在其中
absoluteEpsilon of each other, they are considered equal and this function returns false.
| Name | Type | Description |
|---|---|---|
left |
number | 第一个比较的数字. |
right |
number | 第二数相比较. |
absoluteEpsilon |
number | 用于比较的绝对epsilon. |
Returns:
-NT#############################################################################################################################################################################################################################################################
absoluteEpsilon. false if left is greater or if the two
价值观几乎是平等的.
确定左值小于或等于右值。 如果这两个值都在其中
~
~绝对Epsilon −彼此,它们被认为是平等的,此函数返回为真.
| Name | Type | Description |
|---|---|---|
left |
number | 第一个比较的数字. |
right |
number | 第二数相比较. |
absoluteEpsilon |
number | 用于比较的绝对epsilon. |
Returns:
如果
左 小于 右 或如果
价值几乎相等.
查找数字的基数 2 对数.
| Name | Type | Description |
|---|---|---|
number |
number | The number. |
Returns:
The result.
查找数字到基数的对数.
| Name | Type | Description |
|---|---|---|
number |
number | The number. |
base |
number | The base. |
Returns:
The result.
也有利于负红利的modulo操作.
| Name | Type | Description |
|---|---|---|
m |
number | The dividend. |
n |
number | The divisor. |
Returns:
The remainder.
产生一个角度在范围 - Pi QQ角度 QQ Pi, 相当于所提供的角度 .
| Name | Type | Description |
|---|---|---|
angle |
number | in radians |
Returns:
The angle in the range [
-CesiumMath.PI, CesiumMath.PI].
计算2个整数中的下一个功率大于或等于所提供的非负整数.
由于Javascript中32位位比特操作者的限制,允许输入的最大值为2^31.
| Name | Type | Description |
|---|---|---|
n |
number | The integer to test in the range [0, 2^31]. |
Returns:
下一部二力整数.
Throws:
-
DeveloperError : A number between 0 and 2^31 is required.
Example:
const n = Cesium.Math.nextPowerOfTwo(29); // 32
const m = Cesium.Math.nextPowerOfTwo(32); // 32
Generates a random floating point number in the range of [0.0, 1.0)
使用梅森纳扭矩.
Returns:
A random number in the range of [0.0, 1.0).
- CesiumMath.setRandomNumberSeed
- Mersenne twister on Wikipedia
See:
将范围 [最小范围,最大范围] 的刻度值转换为范围 [0.0, 1.0] 的刻度值
| Name | Type | Description |
|---|---|---|
value |
number | 范围中的 scalar 值 [范围最小值, 范围最大值] |
rangeMinimum |
number | 绘图范围内最小值 . |
rangeMaximum |
number | 绘图范围内的最大值 . |
Returns:
一个scalar值,其中最小地图范围为0.0,最小地图范围为1.0.
计算先前的2个整数的功率小于或等于所提供的非负整数.
由于Javascript中的32位位位操作者限制,允许输入的最大值为(2^32-1).
| Name | Type | Description |
|---|---|---|
n |
number | 在范围测试的整数 [0], (2^32-1). |
Returns:
之前的二强整数.
Throws:
-
DeveloperError : A number between 0 and (2^32)-1 is required.
Example:
const n = Cesium.Math.previousPowerOfTwo(29); // 16
const m = Cesium.Math.previousPowerOfTwo(32); // 32
生成两个数字之间的随机数字.
| Name | Type | Description |
|---|---|---|
min |
number | 最低值. |
max |
number | 最大值 . |
Returns:
分钟和最大值之间的随机数字 .
设置随机数生成器所用的种子
in
CesiumMath#nextRandomNumber.
| Name | Type | Description |
|---|---|---|
seed |
number | 用作种子的整数. |
返回值的标志; 1 如果值为正值, - 1 如果值为
负值,如果值为 0,则为 0.
| Name | Type | Description |
|---|---|---|
value |
number | 值以还兆. |
Returns:
价值之迹.
如果给定值为正值或零,返回1.0,如果为负值,返回-1.0.
This is similar to
CesiumMath#sign except that returns 1.0 instead of
0.0 当输入值为 0.0.
| Name | Type | Description |
|---|---|---|
value |
number | 值以还兆. |
Returns:
价值之迹.
返回数字的双曲正弦 .
#NT##0 值 NT###1 的双曲正弦被定义为
(ex - e-x)/2.0
其中 NT 0 e NT 1 为欧拉的号码,约为2.7828183.
特殊情况:
- 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 与 NT 1 同号
| Name | Type | Description |
|---|---|---|
value |
number | 返回双曲正弦的号码 . |
Returns:
双曲正弦为
值 .
将弧度转换为度 .
| Name | Type | Description |
|---|---|---|
radians |
number | 用弧度转换的角度. |
Returns:
相应的角度以度表示.
将学位转换为弧度.
| Name | Type | Description |
|---|---|---|
degrees |
number | 以度表示的转换角度 . |
Returns:
相应的弧度角.
将范围 [-1.0, 1.0] 的刻度值转换为范围 [0, 范围 Maximum] 的 SNORM
| Name | Type | Default | Description |
|---|---|---|---|
value |
number | 范围中的 scalar 值 [- 1.0, 1.0] | |
rangeMaximum |
number |
255
|
optional 地图范围内的最大值,默认为255. |
Returns:
一个 NT 0 值,其中 0 地图为 -1.0, 范围为 Maximum 地图为 1.0.
- CesiumMath.fromSNorm
See:
产生0 QQ 角度 QQ 2Pi 的角,相当于所提供的角 .
| Name | Type | Description |
|---|---|---|
angle |
number | in radians |
Returns:
The angle in the range [0,
CesiumMath.TWO_PI].