Instantly share code, notes, and snippets.

# Bleuje/cliffordTorus_v1.pde

Created January 31, 2023 21:42
Show Gist options
• Save Bleuje/cd2de169127d5674454b0ebed35abe26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // Processing code by Etienne JACOB // inspired by a shader from tdhooper : https://www.shadertoy.com/view/wsfGDS // motion blur template by beesandbombs int[][] result; float t, c; float c01(float x) { return constrain(x,0,1); } float ease(float p) { return 3*p*p - 2*p*p*p; } float ease(float p, float g) { if (p < 0.5) return 0.5 * pow(2*p, g); else return 1 - 0.5 * pow(2*(1 - p), g); } float map(float x, float a, float b, float c, float d, boolean constr) { return constr ? constrain(map(x,a,b,c,d),min(c,d),max(c,d)) : map(x,a,b,c,d); } float mp01(float x, float a, float b) { return map(x,a,b,0,1,true); } float pow_(float p,float g) { return 1-pow(1-p,g); } float tanh(float x) { return (float)Math.tanh(x); } float softplus(float q,float p){ float qq = q+p; if(qq<=0){ return 0; } if(qq>=2*p){ return qq-p; } return 1/(4*p)*qq*qq; } float mn = .5*sqrt(3), ia = atan(sqrt(.5)); void push() { pushMatrix(); pushStyle(); } void pop() { popStyle(); popMatrix(); } void draw() { if (!recording) { t = (mouseX*1.2/width)%1; c = mouseY*1.0/height; if (mousePressed) println(c); draw_(); } else { for (int i=0; i> 16 & 0xff; result[i][1] += pixels[i] >> 8 & 0xff; result[i][2] += pixels[i] & 0xff; } } loadPixels(); for (int i=0; i