123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <h1>[name]</h1>
- <div class="desc">Math utility functions</div>
- <h2>Methods</h2>
- <h3>.clamp( [page:Float x], [page:Float a], [page:Float b] ) [page:Float]</h3>
- <div>
- x — Value to be clamped.<br />
- a — Minimum value<br />
- b — Maximum value.
- </div>
- <div>
- Clamps the <strong>x</strong> to be between <strong>a</strong> and <strong>b</strong>.
- </div>
- <h3>.clampBottom( [page:Float x], [page:Float a] ) [page:Float]</h3>
- <div>
- x — Value to be clamped.<br />
- a — Minimum value
- </div>
- <div>
- Clamps the <strong>x</strong> to be larger than <strong>a</strong>.
- </div>
- <h3>.mapLinear( [page:Float x], [page:Float a] ) [page:Float]</h3>
- <div>
- x — Value to be mapped.<br />
- a1 — Minimum value for range A.<br />
- a2 — Maximum value for range A.<br />
- b1 — Minimum value for range B.<br />
- b2 — Maximum value for range B.
- </div>
- <div>
- Linear mapping of <strong>x</strong> from range [<strong>a1</strong>, <strong>a2</strong>] to range [<strong>b1</strong>, <strong>b2</strong>].
- </div>
- <h3>.random16() [page:Float]</h3>
- <div>
- Random float from 0 to 1 with 16 bits of randomness.<br />
- Standard Math.random() creates repetitive patterns when applied over larger space.
- </div>
- <h3>.randInt( [page:Integer low], [page:Integer high] ) [page:Integer]</h3>
- <div>
- Random integer from <strong>low</strong> to <strong>high</strong> interval.
- </div>
- <h3>.randFloat( [page:Float low], [page:Float high] ) [page:Float]</h3>
- <div>
- Random float from <strong>low</strong> to <strong>high</strong> interval.
- </div>
- <h3>.randFloatSpread( [page:Float range] ) [page:Float]</h3>
- <div>
- Random float from <strong>- range / 2</strong> to <strong>range / 2</strong> interval.
- </div>
- <h2>Source</h2>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
|