Skip to content

Instantly share code, notes, and snippets.

Introscopia

Block or report user

Report or block Introscopia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Drawing_Order_Planets.pde
float theta;
boolean over;
void setup() {
size(400, 400);
theta = HALF_PI;
over = true;
}
void draw() {
background(0);
View Binary_Clock.pde
/*
Simple Binary Clock in Processing.
Relogio Binario simples em Processing.
*/
float tx, ty, dx, dy;
void setup() {
size(400, 350);
tx = width / 9f;
ty = height / 3f;
@Introscopia
Introscopia / input_event_monitor.pde
Last active Jun 5, 2017
displays a kind of graph of input event timings.
View input_event_monitor.pde
int Z, W;
String[] titles = { "frame", "mousePressed()", "mouseDragged()", "mouseReleased()", "mouseClicked()", "mouseWheel()", "keyPressed()", "keyReleased()", "keyTyped()" };
float x, h, M;
float[] y;
void setup(){
size(1200, 300);
x = 0;
for( int i = 0; i < titles.length; ++i ) if( textWidth( titles[i] ) > x ) x = textWidth( titles[i] );
@Introscopia
Introscopia / Grav.pde
Last active Sep 19, 2017
finished gravitational particle system sketch.
View Grav.pde
ArrayList<Particle> PS; //Here's our array of objects
IntList marked;
float G = 0.2, one_over_pi = 1/PI;
float cx, cy;
float torus_x, torus_y, torus_l, torus_b, torus_w, torus_h; // position and dimensions of the torus box.
byte background_mode = 0;
boolean record = false; //true; //
View Basic Gravity.txt
void gravitate( Particle p ){
PVector grav = new PVector(1,0);
grav.setMag( G*(p.area()) / sq( constrain(dist(pos.x, pos.y, p.pos.x, p.pos.y), 1, 100000) ) );
grav.rotate(atan2(p.pos.y - pos.y, p.pos.x - pos.x ));
acc.add(grav);
}
@Introscopia
Introscopia / Tori.txt
Created Apr 28, 2017
explaining the topology of screens that warp top-to-bottom and left-to-right,
View Tori.txt
This creates a toroidal topology,
hence the name of the method and variables I used to accomplish this.
A torus is a doughnut shape, we say that these top-bottom and right-left
"warps" form a toroidal topology because
the only way to take a piece of paper and fold it such that
it actually connects those edges in that way
is to make a doughnut shape with it.
View rudimentary inelastic collisions.txt
//rudimentary inelastic collisions
for(int i = 1; i < PS.length; ++i){ // loop through the particle array
for(int j = 0; j < i; j++){ // only checking each pair of objects once.
if( PS[i].alive && PS[j].alive ){
if( PS[i].pos.dist( PS[j].pos ) < PS[i].R + PS[j].R ){
int a = ( PS[i].R > PS[j].R )? i : j; // the larger one
int b = ( a == i )? j : i; // absorbs the smaller one.
PS[a].vel.set( PS[b].vel.mult( (PI*sq(PS[b].R)) / (PI*sq(PS[a].R)) ) ); // gains it's kinetic energy
PS[a].R = sqrt( sq(PS[a].R) + sq(PS[b].R) ); // and it's area.
PS[a].D = PS[a].R * 2; // refresh the diameter.
@Introscopia
Introscopia / OOP.pde
Last active May 5, 2017
bouncing ball demo LVL.3
View OOP.pde
Particle[] PS; //Here's our array of objects
float G = 0.2;
void setup(){
size(800, 600);
// initialization for the array...
PS = new Particle[60];
// and for each object.
View OoAs_vs_AoOs.txt
// Object of Arrays
Particle_system the_system;
Class Particle_system{
PVector[] positions, velocities;
}
// Array of Objects
Particle[] particle_system;
@Introscopia
Introscopia / vectors.pde
Created Apr 28, 2017
bouncing ball demo LVL.2
View vectors.pde
PVector pos, vel;
float R, D;
void setup(){
size(400, 400);
pos = new PVector( 200, 200 );
vel = new PVector( random(-3, 3), random(-3, 3) );
R = 10;
D = 2 * R;
You can’t perform that action at this time.