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
//demo of the interactive pointer | |
function translate(tx, ty, func){ | |
return function(x,y){ | |
var xprime = x-tx; | |
var yprime = y-ty; | |
return func(xprime,yprime); | |
} | |
} |
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
function translate(tx, ty, func){ | |
return function(x,y){ | |
var xprime = x-tx; | |
var yprime = y-ty; | |
return func(xprime,yprime); | |
} | |
} | |
function rotate(theta, func){ |
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
function mandlebrot(x0,y0){ | |
var x = 0 | |
var y = 0 | |
var xtemp; | |
var iteration = 0 | |
var max_iteration = 20 | |
while( x*x + y*y < 4 && iteration < max_iteration ) //Remember: 4 == (2*2) | |
{ |
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
#define ADXL345_ADDR_ALT_LOW 0x53 | |
#define FIMU_ACC_ADDR ADXL345_ADDR_ALT_LOW | |
#define ADXL345_POWER_CTL 0x2d | |
#define ADXL345_DATAX0 0x32 | |
#define TO_READ (6) | |
#include <Wire.h> | |
int accelx; | |
int accely; |
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
float sc; | |
float tau; | |
void setup(){ | |
size(500,500); | |
smooth(); | |
strokeWeight(1); | |
background(255); | |
sc = height*10; |
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
function makecircle(r){ | |
return function(x,y){ | |
return Math.pow(x,2) + Math.pow(y,2) < Math.pow(r,2); | |
} | |
} | |
function translate(tx, ty, func){ | |
return function(x,y){ |
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
//make lumpy circles | |
function makecircle(r){ | |
return function(x,y){ | |
return Math.pow(x,2) + Math.pow(y,2) < Math.pow(r,2); | |
} | |
} | |
function translate(tx, ty, func){ | |
return function(x,y){ |
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
float theta; | |
float phi; | |
float r; | |
void setup(){ | |
size(640, 360, P3D); | |
smooth(); | |
theta=0; | |
phi=0; | |
r=100; |
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
function makesphere(r){ | |
return function(x,y,z){ | |
return Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2) < Math.pow(r,2); | |
} | |
} | |
emit( makesphere(90) ); |
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
function dist(x,y,z){ | |
return Math.pow(Math.pow(x,2)+Math.pow(y,2)+Math.pow(z,2),0.5); | |
} | |
function max(a,b){ | |
if(a>b){ | |
return a; | |
}else{ | |
return b; | |
} |