docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
34
noise-unit.html
Normal file
34
noise-unit.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Noise.unit — Ludic</title>
|
||||
<meta name="description" content="Remap a [-1,1] noise sample to [0,1].">
|
||||
<link rel="stylesheet" href="base.css">
|
||||
<link rel="stylesheet" href="docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||||
<main class="wrap item">
|
||||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="ns-noise.html">Noise</a> <span>›</span> <span class="here">Noise.unit</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-method">method</span>
|
||||
<h1 id="top">Noise.unit</h1>
|
||||
</div>
|
||||
<code class="sig">Noise.unit(n) -> fixed</code>
|
||||
<div class="desc"><p>Remaps a noise sample from <code>[-1, 1]</code> to <code>[0, 1]</code> — literally <code>n / 2 + 0.5</code> — returning a <a href="type-fixed"><code>fixed</code></a>. The signed range is the natural output of the samplers, but heights, densities, probabilities, and colour ramps usually want the unsigned <code>[0, 1]</code> range; <code>unit</code> is the one-step conversion. It is a plain affine remap, so <code>unit(-1) == 0</code>, <code>unit(0) == 0.5</code>, and <code>unit(1) == 1</code>.</p></div>
|
||||
<div class="params"><h2>Parameters</h2><div class="param" id="param-n"><code class="pname">n</code><span class="pdesc">a sample in <code>[-1, 1]</code> (e.g. from <code>perlin2</code>/<code>simplex2</code>/<code>fbm2</code>)</span></div></div>
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Unit {
|
||||
entry {
|
||||
let n = Noise.simplex2(fixed(1) / fixed(2), fixed(1) / fixed(2), 1337)
|
||||
let height = Math.floor(Noise.unit(n) * fixed(64)) # 0..64 tiles
|
||||
print(height)
|
||||
}
|
||||
}</pre></div>
|
||||
|
||||
<a class="back" href="api.html">← All symbols</a>
|
||||
</main>
|
||||
<script src="ludic-highlight.js"></script>
|
||||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||||
</body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue