import {useEffect, useState} from "react"; import Canvas from "../src/Canvas"; import { Params, chaosGameWeighted } from "./chaosGameWeighted"; import TeX from '@matejmazur/react-katex'; type Transform = (x: number, y: number) => [number, number]; function WeightInput({value, setValue, children}) { return (
{children} setValue(Number(e.currentTarget.value))}/>
) } export default function GasketWeighted() { const image = new ImageData(600, 600); const iterations = 100_000; const step = 1000; const [f0Weight, setF0Weight] = useState(1); const [f1Weight, setF1Weight] = useState(1); const [f2Weight, setF2Weight] = useState(1); const f0: Transform = (x, y) => [x / 2, y / 2]; const f1: Transform = (x, y) => [(x + 1) / 2, y / 2]; const f2: Transform = (x, y) => [x / 2, (y + 1) / 2]; const [game, setGame] = useState>(null); useEffect(() => { const params: Params = { transforms: [ [f0Weight, f0], [f1Weight, f1], [f2Weight, f2] ], image, iterations, step } setGame(chaosGameWeighted(params)) }, [f0Weight, f1Weight, f2Weight]); return ( <>

F_0 weight:{f0Weight}

F_1 weight:{f1Weight}

F_2 weight:{f2Weight}

) }