mirror of
https://github.com/bspeice/speice.io
synced 2025-07-02 06:16:22 -04:00
Basic function weights
This commit is contained in:
@ -1,5 +0,0 @@
|
||||
import {useColorMode, useThemeConfig} from "@docusaurus/theme-common";
|
||||
|
||||
export default function BaselineRender({children}) {
|
||||
const {colorMode, setColorMode} = useColorMode();
|
||||
}
|
@ -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];
|
||||
}
|
@ -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:
|
||||
|
||||
|
Reference in New Issue
Block a user