mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-23 14:07:57 +01:00
118 lines
3.2 KiB
HTML
118 lines
3.2 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8" />
|
||
|
<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">Math utility functions</div>
|
||
|
|
||
|
<h2>Properties</h2>
|
||
|
|
||
|
<h2>Methods</h2>
|
||
|
|
||
|
<h3>[method:Float clamp]( [page:Float x], [page:Float a], [page:Float b] )</h3>
|
||
|
<div>
|
||
|
x — Value to be clamped.<br />
|
||
|
a — Minimum value<br />
|
||
|
b — Maximum value.
|
||
|
</div>
|
||
|
<div>
|
||
|
Clamps the *x* to be between *a* and *b*.
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float clampBottom]( [page:Float x], [page:Float a] )</h3>
|
||
|
<div>
|
||
|
x — Value to be clamped.<br />
|
||
|
a — Minimum value
|
||
|
</div>
|
||
|
<div>
|
||
|
Clamps the *x* to be larger than *a*.
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float mapLinear]( [page:Float x], [page:Float a1], [page:Float a2], [page:Float b1], [page:Float b2] )</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 *x* from range [*a1*, *a2*] to range [*b1*, *b2*].
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float random16]()</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>[method:Integer randInt]( [page:Integer low], [page:Integer high] )</h3>
|
||
|
<div>
|
||
|
Random integer from *low* to *high* interval.
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float randFloat]( [page:Float low], [page:Float high] )</h3>
|
||
|
<div>
|
||
|
Random float from *low* to *high* interval.
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float randFloatSpread]( [page:Float range] )</h3>
|
||
|
<div>
|
||
|
Random float from *- range / 2* to *range / 2* interval.
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float sign]( [page:Float x] )</h3>
|
||
|
<div>
|
||
|
Returns -1 if *x* is less than 0, 1 if *x* is greater than 0, and 0 if *x* is zero.
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float degToRad]([page:Float degrees])</h3>
|
||
|
<div>
|
||
|
degrees -- [page:Float]
|
||
|
</div>
|
||
|
<div>
|
||
|
Converts degrees to radians.
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float radToDeg]([page:Float radians])</h3>
|
||
|
<div>
|
||
|
radians -- [page:Float]
|
||
|
</div>
|
||
|
<div>
|
||
|
Converts radians to degrees
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float smoothstep]([page:Float x], [page:Float min], [page:Float max])</h3>
|
||
|
<div>
|
||
|
x -- The value to evaluate based on its position between min and max. <br />
|
||
|
min -- Any x value below min will be 0 <br />
|
||
|
max -- Any x value above max will be 1
|
||
|
</div>
|
||
|
<div>
|
||
|
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/>
|
||
|
|
||
|
[link:http://en.wikipedia.org/wiki/Smoothstep Wikipedia]
|
||
|
</div>
|
||
|
|
||
|
<h3>[method:Float smootherstep]([page:Float x], [page:Float min], [page:Float max])</h3>
|
||
|
<div>
|
||
|
x -- The value to evaluate based on its position between min and max. <br />
|
||
|
min -- Any x value below min will be 0 <br />
|
||
|
max -- Any x value above max will be 1
|
||
|
</div>
|
||
|
<div>
|
||
|
Returns a value between 0-1. It works the same as smoothstep, but more smooth.
|
||
|
</div>
|
||
|
|
||
|
<h2>Source</h2>
|
||
|
|
||
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
||
|
</body>
|
||
|
</html>
|