# 数学函数（[name]）

## 函数（Functions）

### [method:Float clamp]( [param:Float value], [param:Float min], [param:Float max] )

[page:Float value] — 需要clamp处理的值。
[page:Float min] — 最小值。
[page:Float max] — 最大值。

### [method:Integer euclideanModulo]( [param:Integer n], [param:Integer m] )

[page:Integer n], [page:Integer m] - 整型

### [method:Float inverseLerp]( [param:Float x], [param:Float y], [param:Float value] )

[page:Float x] - Start point.
[page:Float y] - End point.
[page:Float value] - A value between start and end.

Returns the percentage in the closed interval [0, 1] of the given value between the start and end point.

### [method:Float lerp]( [param:Float x], [param:Float y], [param:Float t] )

[page:Float x] - 起始点。
[page:Float y] - 终点。
[page:Float t] - 闭区间 [0,1] 内的插值因子。

### [method:Float damp]( [param:Float x], [param:Float y], [param:Float lambda], [param:Float dt] )

[page:Float x] - Current point.
[page:Float y] - Target point.
[page:Float lambda] - A higher lambda value will make the movement more sudden, and a lower value will make the movement more gradual.
[page:Float dt] - Delta time in seconds.

Smoothly interpolate a number from [page:Float x] toward [page:Float y] in a spring-like manner using the [page:Float dt] to maintain frame rate independent movement. For details, see [link:http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ Frame rate independent damping using lerp].

### [method:Float mapLinear]( [param:Float x], [param:Float a1], [param:Float a2], [param:Float b1], [param:Float b2] )

[page:Float x] — 用于映射的值。
[page:Float a1] — A区间最小值。
[page:Float a2] — A区间最大值。
[page:Float b1] — B区间最小值。
[page:Float b2] — A区间最大值。

x从范围[[page:Float a1], [page:Float a2]] 到范围[[page:Float b1], [page:Float b2]]的线性映射。

### [method:Float pingpong]( [param:Float x], [param:Float length] )

[page:Float x] — The value to pingpong.
[page:Float length] — The positive value the function will pingpong to. Default is 1.

Returns a value that alternates between 0 and [param:Float length].

### [method:Float smoothstep]( [param:Float x], [param:Float min], [param:Float max] )

[page:Float x] - 根据其在最小值和最大值之间的位置来计算的值。
[page:Float min] - 任何x比最小值还小会返回0.
[page:Float max] - 任何x比最大值还大会返回1.

### [method:Float smootherstep]( [param:Float x], [param:Float min], [param:Float max] )

[page:Float x] - 根据其在最小值和最大值之间的位置来计算的值。
[page:Float min] - 任何x比最小值还小会返回0.
[page:Float max] - 任何x比最大值还大会返回0.

### [method:null setQuaternionFromProperEuler]( [param:Quaternion q], [param:Float a], [param:Float b], [param:Float c], [param:String order] )

[page:Quaternion q] - the quaternion to be set
[page:Float a] - the rotation applied to the first axis, in radians
[page:Float b] - the rotation applied to the second axis, in radians
[page:Float c] - the rotation applied to the third axis, in radians
[page:String order] - a string specifying the axes order: 'XYX', 'XZX', 'YXY', 'YZY', 'ZXZ', or 'ZYZ'

Sets quaternion [page:Quaternion q] from the [link:http://en.wikipedia.org/wiki/Euler_angles intrinsic Proper Euler Angles] defined by angles [page:Float a], [page:Float b], and [page:Float c], and order [page:String order].
Rotations are applied to the axes in the order specified by [page:String order]: rotation by angle [page:Float a] is applied first, then by angle [page:Float b], then by angle [page:Float c]. Angles are in radians.