2023-07-20 19:55:26 -04:00
|
|
|
import { randomBiUnit, weightedChoice } from "./0-utility";
|
2023-07-01 00:38:15 -04:00
|
|
|
import {
|
|
|
|
Coefs,
|
|
|
|
Variation,
|
|
|
|
Transform,
|
|
|
|
transform1Weight,
|
2023-07-02 15:49:36 -04:00
|
|
|
transform1,
|
2023-07-01 00:38:15 -04:00
|
|
|
transform2Weight,
|
2023-07-02 15:49:36 -04:00
|
|
|
transform2,
|
2023-07-01 00:38:15 -04:00
|
|
|
transform3Weight,
|
2023-07-02 15:49:36 -04:00
|
|
|
transform3,
|
2023-07-15 18:48:06 -04:00
|
|
|
identityCoefs,
|
2023-07-20 19:55:26 -04:00
|
|
|
RendererFlame,
|
2023-07-01 00:38:15 -04:00
|
|
|
} from "./2a-variations";
|
|
|
|
|
|
|
|
export class TransformPost extends Transform {
|
|
|
|
constructor(
|
|
|
|
coefs: Coefs,
|
|
|
|
variations: [number, Variation][],
|
|
|
|
public readonly post: Coefs
|
|
|
|
) {
|
|
|
|
super(coefs, variations);
|
|
|
|
}
|
|
|
|
|
|
|
|
apply(x: number, y: number): [number, number] {
|
|
|
|
const [transformX, transformY] = super.apply(x, y);
|
|
|
|
return [
|
|
|
|
transformX * this.post.a + transformY * this.post.b + this.post.c,
|
|
|
|
transformX * this.post.d + transformY * this.post.e + this.post.f,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-15 18:48:06 -04:00
|
|
|
export const transform1Post = new TransformPost(
|
|
|
|
transform1.coefs,
|
|
|
|
transform1.variations,
|
|
|
|
identityCoefs
|
|
|
|
);
|
|
|
|
|
2023-07-02 15:49:36 -04:00
|
|
|
export const transform2Post = new TransformPost(
|
|
|
|
transform2.coefs,
|
2023-07-15 18:48:06 -04:00
|
|
|
transform2.variations,
|
2023-07-02 15:49:36 -04:00
|
|
|
{
|
|
|
|
a: 1,
|
|
|
|
b: 0,
|
|
|
|
c: 0.241352,
|
|
|
|
d: 0,
|
|
|
|
e: 1,
|
|
|
|
f: 0.271521,
|
|
|
|
}
|
|
|
|
);
|
2023-07-01 00:38:15 -04:00
|
|
|
|
2023-07-15 18:48:06 -04:00
|
|
|
export const transform3Post = new TransformPost(
|
|
|
|
transform3.coefs,
|
|
|
|
transform3.variations,
|
|
|
|
identityCoefs
|
|
|
|
);
|
|
|
|
|
2023-07-20 19:55:26 -04:00
|
|
|
export const transformAllPost: [number, TransformPost][] = [
|
|
|
|
[transform1Weight, transform1Post],
|
|
|
|
[transform2Weight, transform2Post],
|
|
|
|
[transform3Weight, transform3Post],
|
|
|
|
];
|
2023-07-02 15:30:56 -04:00
|
|
|
|
2023-07-20 19:55:26 -04:00
|
|
|
export function buildPost(size: number) {
|
|
|
|
return new RendererFlame(size, transformAllPost);
|
2023-07-01 00:38:15 -04:00
|
|
|
}
|