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
// Determine THETA between 2 points with arcTangent atan2() function | |
int x, y; | |
void setup() { | |
size(500, 500); | |
x = width/2; | |
y = height/2; | |
textSize(20); | |
textAlign(CENTER, CENTER); |
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
# Opens interactive shell upon execution. | |
import code;code.interact(local=locals()) |
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
''' | |
____________COMMAND LINE PROMPT______________________ | |
\d: Date | |
\h: Host computers name (eg NewTron.local) | |
\n: Newline | |
\t: Time | |
\u: Username | |
\W: Current working directory | |
\w: Full path to current directory | |
''' |
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
String timestamp; | |
void setup() { | |
timestamp = year() + nf(month(),2) + nf(day(),2) + "-" + nf(hour(),2) + nf(minute(),2) + nf(second(),2); | |
println(timestamp); | |
exit(); | |
} | |
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
txtblk='\e[0;30m' # Black - Regular | |
txtred='\e[0;31m' # Red | |
txtgrn='\e[0;32m' # Green | |
txtylw='\e[0;33m' # Yellow | |
txtblu='\e[0;34m' # Blue | |
txtpur='\e[0;35m' # Purple | |
txtcyn='\e[0;36m' # Cyan | |
txtwht='\e[0;37m' # White | |
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
// KeyPress SpaceBar Toggle Switch | |
void keyPressed() { | |
if (key == ' '){ | |
showVectors = !showVectors; | |
} | |
} |
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
////////////////////////////////////////////////////// | |
// Create a Perlin Noise Field | |
void initPerlinField() { | |
// Reseed Noise | |
noiseSeed((int)random(10000)); | |
//TODO: make the x,y noise offset a PVector | |
float xOffSetNoise = 0; | |
// Iterate through the 2D array of PVectors | |
for (int i = 0; i < flowFieldCols; ++i) { |
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
// Calc length of vector and scale it | |
float lenOfSpecificVector = specificVector.mag()*scayl; |
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
// Convert Polar to Cartesian | |
// according to SOHCAHTOA, cos(theta)=1 and sin(theta) = 0 when theta = 0 (aka (1,0)) | |
vector = new PVector(cos(theta), sin(theta)); | |
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
// Incrementing Noise to THETA | |
for (int i = 0; i < flowFieldCols; ++i) { | |
float yOffSetNoise = 0; | |
for (int j = 0; j < flowFieldRows; ++j) { | |
float theta = map(noise(xOffSetNoise, yOffSetNoise), 0 ,1 ,0 ,TWO_PI); | |
// Convert from Polar to Cartesian | |
// according to SOHCAHTOA, cos(theta)=1 and sin(theta) = 0 when theta = 0 (aka (1,0)) | |
vectorField[i][j] = new PVector(cos(theta), sin(theta)); |
OlderNewer