.
@@ -60,7 +60,7 @@ function Bezier(n,t,w[]):
|
||||
return sum
|
||||
```
|
||||
|
||||
And now for the extremely optimized versions:
|
||||
And now for the optimized versions:
|
||||
|
||||
```
|
||||
function Bezier(2,t,w[]):
|
||||
|
@@ -57,7 +57,7 @@ draw() {
|
||||
|
||||
drawHighlight() {
|
||||
let c = screenToWorld({
|
||||
x: map(this.position, 0, 1, -10, this.width + 10),
|
||||
x: map(this.position, -0.1, 1.1, 0, this.width),
|
||||
y: this.height/2
|
||||
});
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
@@ -682,7 +682,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="Quadratic interpolations" width="275" height="275" src="./chapters/control/lerp.js" data-degree="3">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\71d891b569460c79765670d3f49d2da9.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\42328a6806cce466a84762d24a0bf7f2.png" />
|
||||
<label>Quadratic interpolations</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
@@ -691,7 +691,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="Cubic interpolations" width="275" height="275" src="./chapters/control/lerp.js" data-degree="4">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\3b627846198c0cb3c542fe13cb923029.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\d77c40cdea1037003e9d8aafea57f9a2.png" />
|
||||
<label>Cubic interpolations</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
@@ -700,7 +700,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="15th degree interpolations" width="275" height="275" src="./chapters/control/lerp.js" data-degree="15">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\2cc2f0127510f2700656c2f894b36674.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\50ae7279f2827b557f76379c80d00a83.png" />
|
||||
<label>15th degree interpolations</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
@@ -745,7 +745,7 @@ function Bezier(3,t):
|
||||
for(k=0; k<=n; k++):
|
||||
sum += w[k] * binomial(n,k) * (1-t)^(n-k) * t^(k)
|
||||
return sum</code></pre>
|
||||
<p>And now for the extremely optimized versions:</p>
|
||||
<p>And now for the optimized versions:</p>
|
||||
<pre><code>function Bezier(2,t,w[]):
|
||||
t2 = t * t
|
||||
mt = 1-t
|
||||
|
@@ -602,7 +602,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="2次の補間" width="275" height="275" src="./chapters/control/lerp.js" data-degree="3">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\71d891b569460c79765670d3f49d2da9.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\42328a6806cce466a84762d24a0bf7f2.png" />
|
||||
<label>2次の補間</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
@@ -611,7 +611,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="3次の補間" width="275" height="275" src="./chapters/control/lerp.js" data-degree="4">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\3b627846198c0cb3c542fe13cb923029.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\d77c40cdea1037003e9d8aafea57f9a2.png" />
|
||||
<label>3次の補間</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
@@ -620,7 +620,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="15次の補間" width="275" height="275" src="./chapters/control/lerp.js" data-degree="15">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\2cc2f0127510f2700656c2f894b36674.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\50ae7279f2827b557f76379c80d00a83.png" />
|
||||
<label>15次の補間</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
|
@@ -205,20 +205,22 @@ pre img.LaTeX.SVG {
|
||||
|
||||
pre {
|
||||
display: inline-block;
|
||||
margin-left: 1em;
|
||||
margin-left: 0;
|
||||
background-color: var(--code-block-color);
|
||||
padding: 0.5em;
|
||||
border: 1px dotted gray;
|
||||
}
|
||||
|
||||
code {
|
||||
position: relative;
|
||||
font-family: monospace;
|
||||
font-size: 0.9rem;
|
||||
@media screen and (min-width: 768px) {
|
||||
pre { margin-left: 1em; }
|
||||
}
|
||||
|
||||
p code {
|
||||
|
||||
code {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
li code, p code {
|
||||
display: inline-block;
|
||||
border: 1px solid #DDD;
|
||||
border-radius: 5px;
|
||||
|
@@ -572,7 +572,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="二次插值" width="275" height="275" src="./chapters/control/lerp.js" data-degree="3">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\71d891b569460c79765670d3f49d2da9.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\42328a6806cce466a84762d24a0bf7f2.png" />
|
||||
<label>二次插值</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
@@ -581,7 +581,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="三次插值" width="275" height="275" src="./chapters/control/lerp.js" data-degree="4">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\3b627846198c0cb3c542fe13cb923029.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\d77c40cdea1037003e9d8aafea57f9a2.png" />
|
||||
<label>三次插值</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
@@ -590,7 +590,7 @@ function Bezier(3,t):
|
||||
<graphics-element title="15次插值" width="275" height="275" src="./chapters/control/lerp.js" data-degree="15">
|
||||
<fallback-image>
|
||||
<span class="view-source">Scripts are disabled. Showing fallback image.</span>
|
||||
<img width="275px" height="275px" src="images\chapters\control\2cc2f0127510f2700656c2f894b36674.png" />
|
||||
<img width="275px" height="275px" src="images\chapters\control\50ae7279f2827b557f76379c80d00a83.png" />
|
||||
<label>15次插值</label>
|
||||
</fallback-image>
|
||||
<input type="range" min="0" max="1" step="0.01" value="0" class="slide-control" />
|
||||
|