source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/docs/api/math/Math.html@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 3.2 KB
Line 
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <script src="../../list.js"></script>
6 <script src="../../page.js"></script>
7 <link type="text/css" rel="stylesheet" href="../../page.css" />
8 </head>
9 <body>
10 <h1>[name]</h1>
11
12 <div class="desc">Math utility functions</div>
13
14 <h2>Properties</h2>
15
16 <h2>Methods</h2>
17
18 <h3>.clamp( [page:Float x], [page:Float a], [page:Float b] ) [page:Float]</h3>
19 <div>
20 x — Value to be clamped.<br />
21 a — Minimum value<br />
22 b — Maximum value.
23 </div>
24 <div>
25 Clamps the *x* to be between *a* and *b*.
26 </div>
27
28 <h3>.clampBottom( [page:Float x], [page:Float a] ) [page:Float]</h3>
29 <div>
30 x — Value to be clamped.<br />
31 a — Minimum value
32 </div>
33 <div>
34 Clamps the *x* to be larger than *a*.
35 </div>
36
37 <h3>.mapLinear( [page:Float x], [page:Float a1], [page:Float a2], [page:Float b1], [page:Float b2] ) [page:Float]</h3>
38 <div>
39 x — Value to be mapped.<br />
40 a1 — Minimum value for range A.<br />
41 a2 — Maximum value for range A.<br />
42 b1 — Minimum value for range B.<br />
43 b2 — Maximum value for range B.
44 </div>
45 <div>
46 Linear mapping of *x* from range [*a1*, *a2*] to range [*b1*, *b2*].
47 </div>
48
49 <h3>.random16() [page:Float]</h3>
50 <div>
51 Random float from 0 to 1 with 16 bits of randomness.<br />
52 Standard Math.random() creates repetitive patterns when applied over larger space.
53 </div>
54
55 <h3>.randInt( [page:Integer low], [page:Integer high] ) [page:Integer]</h3>
56 <div>
57 Random integer from *low* to *high* interval.
58 </div>
59
60 <h3>.randFloat( [page:Float low], [page:Float high] ) [page:Float]</h3>
61 <div>
62 Random float from *low* to *high* interval.
63 </div>
64
65 <h3>.randFloatSpread( [page:Float range] ) [page:Float]</h3>
66 <div>
67 Random float from *- range / 2* to *range / 2* interval.
68 </div>
69
70 <h3>.sign( [page:Float x] ) [page:Float]</h3>
71 <div>
72 Returns -1 if *x* is less than 0, 1 if *x* is greater than 0, and 0 if *x* is zero.
73 </div>
74
75 <h3>.degToRad([page:Float degrees]) [page:Float]</h3>
76 <div>
77 degrees -- [page:Float]
78 </div>
79 <div>
80 Converts degrees to radians.
81 </div>
82
83 <h3>.radToDeg([page:Float radians]) [page:Float]</h3>
84 <div>
85 radians -- [page:Float]
86 </div>
87 <div>
88 Converts radians to degrees
89 </div>
90
91 <h3>.smoothstep([page:Float x], [page:Float min], [page:Float max]) [page:Float]</h3>
92 <div>
93 x -- The value to evaluate based on its position between min and max. <br />
94 min -- Any x value below min will be 0 <br />
95 max -- Any x value above max will be 1
96 </div>
97 <div>
98 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/>
99
100 [link:http://en.wikipedia.org/wiki/Smoothstep Wikipedia]
101 </div>
102
103 <h3>.smootherstep([page:Float x], [page:Float min], [page:Float max]) [page:Float]</h3>
104 <div>
105 x -- The value to evaluate based on its position between min and max. <br />
106 min -- Any x value below min will be 0 <br />
107 max -- Any x value above max will be 1
108 </div>
109 <div>
110 Returns a value between 0-1. It works the same as smoothstep, but more smooth.
111 </div>
112
113 <h2>Source</h2>
114
115 [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
116 </body>
117</html>
Note: See TracBrowser for help on using the repository browser.