MathHelper

MathHelper

MathHelper

Members

staticEPSILON : number

一个很小的浮点数,用于浮点数之间的近似相等

Methods

staticBarycentric(value1,value2,value3,amount1,amount2) → number

三个值的质心法插值
Name Type Description
value1 number
value2 number
value3 number
amount1 number 第一条边比例
amount2 number 第二条边比例

staticCatmullRom(value1,value2,value3,value4,amount) → number

CatmullRom曲线插值
Name Type Description
value1 number
value2 number
value3 number
value4 number
amount number

staticClamp(value,min,max) → number

裁剪值到指定范围
Name Type Description
value number
min number
max number

staticDegreeFromDegree(degree) → number

从浮点度数得到整数度数
Name Type Description
degree number

staticDegreeFromDMS(degree,minute,second) → number

从度分秒换算成浮点度数
Name Type Description
degree number
minute number
second number

staticDistance(value1,value2) → number

计算两个值的一维距离
Name Type Description
value1 number 值1
value2 number 值2

staticFloatSecondFromDegree(degree) → number

从浮点度得到浮点数秒
Name Type Description
degree number

staticHermite(value1,tangent1,value2,tangent2,amount) → number

Hermite曲线插值
Name Type Description
value1 number 值1
tangent1 number 值1切线
value2 number 值2
tangent2 number 值2切线
amount number 比例

staticIntPowOfTwo(level) → number

计算2的次幂
Name Type Description
level number 次数

staticLerp(value1,value2,amount) → number

两值之间线性插值
Name Type Description
value1 number 值1
value2 number 值2
amount number 从值1开始的比例

staticMinuteFromDegree(degree) → number

从浮点度得到整数分
Name Type Description
degree number

staticNearEqual(val1,val2,tolerance) → boolean

判断两个值是否近似相等
Name Type Description
val1 number 值1
val2 number 值2
tolerance number optional容差

staticNearZero(val,tolerance) → boolean

判断值是否近似为零
Name Type Description
val number
tolerance number optional容差

staticSecondFromDegree(degree) → number

从浮点度得到整数秒
Name Type Description
degree number

staticSign(val) → number

获取数字的正负符号
Name Type Description
val number

staticToDegrees(radians) → number

弧度转为度
Name Type Description
radians number

staticToRadians(degrees) → number

度转为弧度
Name Type Description
degrees number

staticWrapAngle(angle) → number

把弧度角度变换到0-2PI范围内
Name Type Description
angle number 弧度