Basic function weights

This commit is contained in:
2024-11-24 22:37:53 -05:00
parent 4c3f4246a4
commit 7759b58dbe
24 changed files with 172 additions and 62 deletions

View File

@ -1,5 +0,0 @@
import {useColorMode, useThemeConfig} from "@docusaurus/theme-common";
export default function BaselineRender({children}) {
const {colorMode, setColorMode} = useColorMode();
}

View File

@ -1,22 +0,0 @@
// hidden-start
import { Coefs } from './coefs'
import { Variation } from './variations'
// hidden-end
export function applyTransform(
x: number,
y: number,
coefs: Coefs,
variations: [number, Variation][])
{
const transformX = coefs.a * x + coefs.b * y + coefs.c;
const transformY = coefs.d * x + coefs.e * y + coefs.f;
var finalX = 0;
var finalY = 0;
for (const [blend, variation] of variations) {
const [variationX, variationY] = variation(transformX, transformY);
finalX += blend * variationX;
finalY += blend * variationY;
}
return [finalX, finalY];
}

View File

@ -66,9 +66,6 @@ import linearSrc from '!!raw-loader!../src/linear'
<CodeBlock language={'typescript'}>{linearSrc}</CodeBlock>
Before we move on, it's worth mentioning the relationship between this variation and the Sierpinski Gasket.
Specifically, we can think of the Gasket as a fractal flame that uses only the linear variation.
### Julia (variation 13)
This variation still uses just the $x$ and $y$ coordinates, but does crazy things with them:
@ -132,11 +129,6 @@ $$
The formula looks intimidating, but it's not hard to implement:
import baselineSrc from '!!raw-loader!./baseline'
<CodeBlock language={'typescript'}>{baselineSrc}</CodeBlock>
TODO: Mention that the Sierpinski Gasket is just a blend with linear weight 1, all others 0. Maybe replace comment above about Sierpinski Gasket and linear transform?
TODO: Blending implementation?
And with that in place, we have enough to render a first full fractal flame: