Last active
December 7, 2022 20:20
-
-
Save peternewman22/dc1ce620c9a8dc3658322a23f99c8312 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
// Interesting playing around with different ways of changing m and n | |
// Inspired by the Steve Mould video: https://www.youtube.com/watch?v=rjueHI002Fg | |
// Next steps: implement with a shader | |
float n = 100; | |
float m = 1; | |
float epsilon = 0.1; | |
float res; | |
int count = 500; | |
float increment = 0.001; | |
String currentlyAdjusting = "n"; | |
float nIncrement = 0.1; | |
float cIx = 0; | |
int cChangeRate = 2; | |
boolean start; | |
float displacement = 0.5; | |
void setup() { | |
size(500, 500); | |
background(0); | |
res = width/count; | |
//stroke(255, 0, 0); | |
colorMode(HSB, 360, 100, 100); | |
} | |
void draw() { | |
background(0); | |
stroke(cIx, 100, 100); | |
pushMatrix(); | |
translate(width/2, height/2); | |
for (float row = -height/2; row < count; row++) { | |
for (float col = -width/2; col < count; col++) { | |
// if the x,y are close enough to meeting the equation, draw a point with a little randomness | |
if (abs(cos(n*PI*col*increment)*cos(m*PI*row*increment) - cos(m*PI*col*increment)*cos(n*PI*row*increment)) < epsilon) { | |
point(col*res+random(-displacement,displacement), row*res+random(-displacement,displacement)); // artifical randomness | |
} | |
} | |
} | |
popMatrix(); | |
m += nIncrement; | |
n -= nIncrement; | |
if (frameCount%cChangeRate == 0) { | |
cIx ++; | |
} | |
} |
The big question:
How does the equation change as the boundary or mount points are changed?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Pete ~
I take it this is a Processing script. I haven't worked with it yet. But I could see my way to make it a Python version.