123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <!DOCTYPE html>
- <html lang="zh">
- <head>
- <meta charset="utf-8" />
- <base href="../../../" />
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>数学函数([name])</h1>
- <p class="desc">具有多个数学实用函数的对象。</p>
- <h2>函数(Functions)</h2>
- <h3>[method:Float clamp]( [param:Float value], [param:Float min], [param:Float max] )</h3>
- <p>
- [page:Float value] — 需要clamp处理的值。<br />
- [page:Float min] — 最小值。<br />
- [page:Float max] — 最大值。<br /><br />
- 限制数值[page:Float value]处于最小值[page:Float min]和最大值[page:Float max]之间。
- </p>
- <h3>[method:Float degToRad]( [param:Float degrees] )</h3>
- <p>将度转化为弧度。</p>
- <h3>[method:Integer euclideanModulo]( [param:Integer n], [param:Integer m] )</h3>
- <p>
- [page:Integer n], [page:Integer m] - 整型<br /><br />
- 计算 [page:Integer m] % [page:Integer n] 的欧几里得模:
- <code>( ( n % m ) + m ) % m</code>
- </p>
- <h3>[method:UUID generateUUID]( )</h3>
- <p>
- 创建一个全局唯一标识符 [link:https://en.wikipedia.org/wiki/Universally_unique_identifier UUID]。
- </p>
- <h3>[method:Boolean isPowerOfTwo]( [param:Number n] )</h3>
- <p>如果 [page:Number n] 是2的幂,返回true。</p>
- <h3>[method:Float inverseLerp]( [param:Float x], [param:Float y], [param:Float value] )</h3>
- <p>
- [page:Float x] - Start point.<br />
- [page:Float y] - End point.<br />
- [page:Float value] - A value between start and end.<br><br />
- Returns the percentage in the closed interval [0, 1] of the given value between the start and end point.
- </p>
- <h3>[method:Float lerp]( [param:Float x], [param:Float y], [param:Float t] )</h3>
- <p>
- [page:Float x] - 起始点。 <br />
- [page:Float y] - 终点。 <br />
- [page:Float t] - 闭区间 [0,1] 内的插值因子。<br><br />
- 返回给定区间的线性插值[link:https://en.wikipedia.org/wiki/Linear_interpolation linearly interpolated]结果 - [page:Float t] = 0 将会返回 [page:Float x]
- 如果 [page:Float t] = 1 将会返回 [page:Float y].
- </p>
- <h3>[method:Float damp]( [param:Float x], [param:Float y], [param:Float lambda], [param:Float dt] )</h3>
- <p>
- [page:Float x] - Current point. <br />
- [page:Float y] - Target point. <br />
- [page:Float lambda] - A higher lambda value will make the movement more sudden, and a lower value will make the movement more gradual. <br />
- [page:Float dt] - Delta time in seconds.<br><br />
- 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].
- </p>
- <h3>[method:Float mapLinear]( [param:Float x], [param:Float a1], [param:Float a2], [param:Float b1], [param:Float b2] )</h3>
- <p>
- [page:Float x] — 用于映射的值。<br />
- [page:Float a1] — A区间最小值。<br />
- [page:Float a2] — A区间最大值。<br />
- [page:Float b1] — B区间最小值。<br />
- [page:Float b2] — A区间最大值。<br /><br />
- x从范围[[page:Float a1], [page:Float a2]] 到范围[[page:Float b1], [page:Float b2]]的线性映射。
- </p>
- <h3>[method:Float pingpong]( [param:Float x], [param:Float length] )</h3>
- <p>
- [page:Float x] — The value to pingpong.<br />
- [page:Float length] — The positive value the function will pingpong to. Default is 1.<br /><br />
- Returns a value that alternates between 0 and [param:Float length].</p>
- <h3>[method:Integer ceilPowerOfTwo]( [param:Number n] )</h3>
- <p>返回大于等于 [page:Number n] 的2的最小次幂。</p>
- <h3>[method:Integer floorPowerOfTwo]( [param:Number n] )</h3>
- <p>返回小于等于 [page:Number n] 的2的最大幂。</p>
- <h3>[method:Float radToDeg]( [param:Float radians] )</h3>
- <p>将弧度转换为角度。</p>
- <h3>[method:Float randFloat]( [param:Float low], [param:Float high] )</h3>
- <p>在区间 [[page:Float low], [page:Float high]] 内随机一个浮点数。</p>
- <h3>[method:Float randFloatSpread]( [param:Float range] )</h3>
- <p>在区间 [- [page:Float range] / 2, [page:Float range] / 2] 内随机一个浮点数。</p>
- <h3>[method:Integer randInt]( [param:Integer low], [param:Integer high] )</h3>
- <p>在区间 [[page:Float low], [page:Float high]] 内随机一个整数。</p>
- <h3>[method:Float seededRandom]( [param:Integer seed] )</h3>
- <p>在区间 [0, 1] 中生成确定性的伪随机浮点数。 整数种子是可选的。</p>
- <h3>[method:Float smoothstep]( [param:Float x], [param:Float min], [param:Float max] )</h3>
- <p>
- [page:Float x] - 根据其在最小值和最大值之间的位置来计算的值。 <br />
- [page:Float min] - 任何x比最小值还小会返回0.<br />
- [page:Float max] - 任何x比最大值还大会返回1.<br /><br />
- 返回0-1之间的值,该值表示x在最小值和最大值之间移动的百分比,但是当x接近最小值和最大值时,变化程度会平滑或减慢。<br/><br/>
- 查看更多详情请移步到 [link:http://en.wikipedia.org/wiki/Smoothstep Smoothstep] 。
- </p>
- <h3>[method:Float smootherstep]( [param:Float x], [param:Float min], [param:Float max] )</h3>
- <p>
- [page:Float x] - 根据其在最小值和最大值之间的位置来计算的值。 <br />
- [page:Float min] - 任何x比最小值还小会返回0.<br />
- [page:Float max] - 任何x比最大值还大会返回0.<br /><br />
- 返回一个0-1之间的值。它和smoothstep相同,但变动更平缓。[link:https://en.wikipedia.org/wiki/Smoothstep#Variations variation on smoothstep] 在x=0和x=1处有0阶和二阶导数。
- </p>
- <h3>[method:null setQuaternionFromProperEuler]( [param:Quaternion q], [param:Float a], [param:Float b], [param:Float c], [param:String order] )</h3>
- <p>
- [page:Quaternion q] - the quaternion to be set<br />
- [page:Float a] - the rotation applied to the first axis, in radians <br />
- [page:Float b] - the rotation applied to the second axis, in radians <br />
- [page:Float c] - the rotation applied to the third axis, in radians <br />
- [page:String order] - a string specifying the axes order: 'XYX', 'XZX', 'YXY', 'YZY', 'ZXZ', or 'ZYZ'<br /><br />
- 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].<br />
- 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.
- </p>
- <h2>Source</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </p>
- </body>
- </html>
|