CindyGL
?f(z) := z^7 - 1;
colorplot(
hue(im(log(f(complex(#)))) / (2*pi));
);
CindyJS
.WebGL
.WebGL
: a JavaScript API for interactive 3D and 2D graphics without the use of plug-ins.t = seconds() - t0;
colorplot(
(sin(|A,#|-t) + sin(|B,#|-t) + 2)
* (1/2, 1/3, 1/4) // rgb-vector
);
few line of code
efficient as native applications
WebGL
easy for mathematically oriented users.F(x,y,z) = x2 + y2 + z2 + 2 ⋅ x y z − 1 = 0
colorplot
:
#
:
colorplot(
polyvalues = evaluate_F_at_ray(#);
poly = inverse(
[[0^0, 0^1, 0^2, 0^3],
[1^0, 1^1, 1^2, 1^3],
[2^0, 2^1, 2^2, 2^3],
[3^0, 3^1, 3^2, 3^3]
])*polyvalues; // interpolate
// ray intersection
x = ray(#, firstroot(poly));
// shading using dF
colorize(x)
);
What happens if colorplot(...#...)
is called?
#
→ suitable for parallelization on GPUInitialization:
createimage("julia", 400, 400);
Rendering:
colorplot("julia", // plots to texture
z = complex(#);
// if |z|<2 take the color at z^2+c
if(|z|<2,
imagergb("julia", z^2+c)// and make
+ (0.01, 0.02, 0.03), // it brighter
// otherwise: display black.
(0, 0, 0)
)
);
w1=map(A, B, C, A, D, F); //matrices for
w2=map(A, B, C, D, B, E); //affine maps
w3=map(A, B, C, F, E, C);
colorplot("ifs", //plot and read same texture
hom = [#.x, #.y, 1]; //Homogeneous coordinate
imagergba("ifs", inverse(w1)*hom) +
imagergba("ifs", inverse(w2)*hom) +
imagergba("ifs", inverse(w3)*hom)
);
get(x, y) := //function that reads texture "gol" as T2
imagergb("gol", (mod(x, 80), mod(y, 80))).r;
newstate(x, y) := ( number = // # living neighbors
get(x-1, y+1) + get(x, y+1) + get(x+1, y+1) +
get(x-1, y) + get(x+1, y) +
get(x-1, y-1) + get(x, y-1) + get(x+1, y-1);
if(get(x,y)==1, //cell lives and less than 2
//or more than 3 neighbors -> die
if((number < 2) % (number > 3), 0, 1),
//cell dead + 3 neighbors -> born
if(number==3, 1, 0)
)
);
colorplot("gol", newstate(#.x, #.y));
x′=a∇2x − x y2 + f (1 − x)
y′=b∇2y + x y2 − (f + k)y