123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../" />
- <script src="list.js"></script>
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <div class="desc">An object with several math utility functions.</div>
- <h2>Functions</h2>
- <h3>[method:Float clamp]( [page:Float value], [page:Float min], [page:Float max] )</h3>
- <div>
- [page:Float value] — Value to be clamped.<br />
- [page:Float min] — Minimum value.<br />
- [page:Float max] — Maximum value.<br /><br />
- Clamps the [page:Float value] to be between [page:Float min] and [page:Float max].
- </div>
- <h3>[method:Float degToRad]( [page:Float degrees] )</h3>
- <div>Converts degrees to radians.</div>
- <h3>[method:Integer euclideanModulo]( [page:Integer n], [page:Integer m] )</h3>
- <div>
- [page:Integer n], [page:Integer m] - Integers<br /><br />
- Compute the Euclidean modulo of m % [page:Integer n], that is:
- <code>( ( n % m ) + m ) % m</code>
- </div>
- <h3>[method:UUID generateUUID]( )</h3>
- <div>
- Generate a [link:https://en.wikipedia.org/wiki/Universally_unique_identifier UUID]
- (universally unique identifier).
- </div>
- <h3>[method:Boolean isPowerOfTwo]( [page:Number n] )</h3>
- <div>Return *true* if [page:Number n] is a power of 2.</div>
- <h3>[method:Float lerp]( [page:Float x], [page:Float y], [page:Float t] )</h3>
- <div>
- [page:Float x] - Start point. <br />
- [page:Float y] - End point. <br />
- [page:Float t] - interpolation factor in the closed interval [0, 1].<br><br />
- Returns a value [link:https://en.wikipedia.org/wiki/Linear_interpolation linearly interpolated]
- from two known points based on the given interval - [page:Float t] = 0 will return [page:Float x]
- and [page:Float t] = 1 will return [page:Float y].
- </div>
- <h3>[method:Float mapLinear](
- [page:Float x],
- [page:Float a1],
- [page:Float a2],
- [page:Float b1],
- [page:Float b2] )</h3>
- <div>
- [page:Float x] — Value to be mapped.<br />
- [page:Float a1] — Minimum value for range A.<br />
- [page:Float a2] — Maximum value for range A.<br />
- [page:Float b1] — Minimum value for range B.<br />
- [page:Float b2] — Maximum value for range B.<br /><br />
- Linear mapping of [page:Float x] from range [[page:Float a1], [page:Float a2]] to range [[page:Float b1], [page:Float b2]].
- </div>
- <h3>[method:Integer nearestPowerOfTwo]( [page:Number n] )</h3>
- <div> Return the nearest power of 2 to a given number [page:Number n].</div>
- <h3>[method:Integer nextPowerOfTwo]( [page:Number n] )</h3>
- <div>Return the nearest power of 2 that is bigger than [page:Number n].</div>
- <h3>[method:Float radToDeg]( [page:Float radians] )</h3>
- <div>Converts radians to degrees.</div>
- <h3>[method:Float randFloat]( [page:Float low], [page:Float high] )</h3>
- <div>Random float in the interval [page:Float low] to [page:Float high].</div>
- <h3>[method:Float randFloatSpread]( [page:Float range] )</h3>
- <div>Random float in the intercal *- [page:Float range] / 2* to *[page:Float range] / 2*.</div>
- <h3>[method:Integer randInt]( [page:Integer low], [page:Integer high] )</h3>
- <div>Random integer in the interval [page:Float low] to [page:Float high].</div>
- <h3>[method:Float smoothstep]( [page:Float x], [page:Float min], [page:Float max] )</h3>
- <div>
- [page:Float x] - The value to evaluate based on its position between min and max. <br />
- [page:Float min] - Any x value below min will be 0.<br />
- [page:Float max] - Any x value above max will be 1.<br /><br />
- Returns a value between 0-1 that represents the percentage that x has moved between min and max,
- but smoothed or slowed down the closer X is to the min and max.<br/><br/>
- See [link:http://en.wikipedia.org/wiki/Smoothstep Smoothstep] for details.
- </div>
- <h3>[method:Float smootherstep]( [page:Float x], [page:Float min], [page:Float max] )</h3>
- <div>
- [page:Float x] - The value to evaluate based on its position between min and max. <br />
- [page:Float min] - Any x value below min will be 0.<br />
- [page:Float max] - Any x value above max will be 1.<br /><br />
- Returns a value between 0-1. A [link:https://en.wikipedia.org/wiki/Smoothstep#Variations variation on smoothstep]
- that has zero 1st and 2nd order derivatives at x=0 and x=1.
- </div>
- <h2>Source</h2>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </body>
- </html>
|