forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMath.html
63 lines (50 loc) · 1.76 KB
/
Math.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<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>