Post/final transform implementation

This commit is contained in:
2024-11-30 17:35:42 -05:00
parent 1aa45e3f59
commit 6c4d73f081
17 changed files with 360 additions and 120 deletions

View File

@ -3,7 +3,7 @@ export interface Coefs {
d: number, e: number, f: number
}
export function applyCoefs(x: number, y: number, coefs: Coefs) {
export function applyCoefs(x: number, y: number, coefs: Coefs): [number, number] {
return [
(x * coefs.a + y * coefs.b + coefs.c),
(x * coefs.d + y * coefs.e + coefs.f)

View File

@ -1,4 +1,23 @@
.inputDiv {
.inputGroup {
padding: .5em;
margin: .5em;
border: 1px solid;
border-radius: var(--ifm-global-radius);
border-color: var(--ifm-color-emphasis-500);
}
.inputTitle {
border: 0 solid;
border-bottom: 1px solid;
border-color: var(--ifm-color-emphasis-500);
margin-bottom: .5em;
}
.inputElement {
padding-left: .5em;
padding-right: 1em;
}
.inputElement > p {
margin: 0
}

View File

@ -3,11 +3,14 @@ import { Variation } from './variation'
// hidden-end
export const julia: Variation = (x, y) => {
const r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
const theta = Math.atan2(x, y);
const omega = Math.random() > 0.5 ? 0 : Math.PI;
const sqrtR = Math.sqrt(r);
const thetaVal = theta / 2 + omega;
return [
r * Math.cos(theta / 2 + omega),
r * Math.sin(theta / 2 + omega)
sqrtR * Math.cos(thetaVal),
sqrtR * Math.sin(thetaVal)
]
}

View File

@ -4,11 +4,11 @@
*/
import { Coefs } from './coefs';
import {VariationBlend} from "./variationBlend";
import { linear } from './linear'
import { julia } from './julia'
import { popcorn } from './popcorn'
import {pdj, PdjParams} from './pdj'
import {Variation} from "./variation"
export const identityCoefs: Coefs = {
a: 1, b: 0, c: 0,
@ -25,7 +25,7 @@ export const xform1Coefs = {
d: 1.381068, e: -1.381068, f: 0,
}
export const xform1CoefsPost = identityCoefs;
export const xform1Variations = [
export const xform1Variations: VariationBlend = [
[1, julia]
]
export const xform1Color = 0;
@ -39,7 +39,7 @@ export const xform2CoefsPost = {
a: 1, b: 0, c: 0.241352,
d: 0, e: 1, f: 0.271521,
}
export const xform2Variations = [
export const xform2Variations: VariationBlend = [
[1, linear],
[1, popcorn(xform2Coefs)]
]
@ -51,7 +51,7 @@ export const xform3Coefs = {
d: 0.740356, e: -1.455964, f: -0.362059,
}
export const xform3CoefsPost = identityCoefs;
export const xform3Variations = [
export const xform3Variations: VariationBlend = [
[1, pdj(pdjParams)]
];
export const xform3Color = 0.349;
@ -61,7 +61,7 @@ export const xformFinalCoefs = {
d: 0, e: 2, f: 0
}
export const xformFinalCoefsPost = identityCoefs;
export const xformFinalVariations = [
export const xformFinalVariations: VariationBlend = [
[1, julia]
]
export const xformFinalColor = 0;

View File

@ -0,0 +1,2 @@
import {Variation} from "./variation";
export type VariationBlend = [number, Variation][];