Lissajous & Prolate Code

by rbatzer

/*This example draws voronoi diagram generated by a random set of points.*/
void setup() {
size(1200,600,P3D); //size of your intended pattern
noLoop(); // don’t need to use the draw loop
/*unique name for your file. if left unchanged,
will simply save file with current milisecond*/
String fileName= “voronoi”+millis()+”.pdf”;
beginRaw(PDF, fileName); //enables you to save your design to a pdf
setupVoronoi(); // create your voronoi generator
int a = 3;
int b=4;
int numPoints=200; //must be multiple of n
float x=0;
float y=0;
float delta =0;
float t=0;
delta=(b-1)/b*3.14159265/2;
for (int k=1;k<numPoints;k++) {
t= k*2*3.14159265/numPoints;
x=200*sin(t*a+delta)+600;
y=150*sin(b*t)+300;
voronoi.addPoint(new Vec2D(x,y));
}
int c = 3;
int d=4;
int numPoints2=200; //must be multiple of n
float theta =0;
for (int k=1;k<numPoints2;k++) {
y=5*(c*theta-d*sin(theta));
x=5*(c-d*cos(theta))+20;
theta= theta+23*3.14159/numPoints2;
voronoi.addPoint(new Vec2D(x,y));
voronoi.addPoint(new Vec2D(1200-x,y));
}
drawVoronoi(); //renders your voronoi
endRaw(); //ends the recording
}

/*This example draws voronoi diagram generated by a random set of points.*/
void setup() { size(1200,600,P3D); //size of your intended pattern noLoop(); // don’t need to use the draw loop  /*unique name for your file. if left unchanged, will simply save file with current milisecond*/ String fileName= “voronoi”+millis()+”.pdf”;    beginRaw(PDF, fileName); //enables you to save your design to a pdf        setupVoronoi(); // create your voronoi generator     int a = 3;   int b=4;    int numPoints=200; //must be multiple of n    float x=0;    float y=0;    float delta =0;    float t=0;
delta=(b-1)/b*3.14159265/2;    for (int k=1;k<numPoints;k++) {       t= k*2*3.14159265/numPoints;    x=200*sin(t*a+delta)+600;    y=150*sin(b*t)+300;          voronoi.addPoint(new Vec2D(x,y));  }     int c = 3;   int d=4;    int numPoints2=200; //must be multiple of n    float theta =0;   for (int k=1;k<numPoints2;k++) {       y=5*(c*theta-d*sin(theta));    x=5*(c-d*cos(theta))+20;    theta= theta+23*3.14159/numPoints2;         voronoi.addPoint(new Vec2D(x,y));         voronoi.addPoint(new Vec2D(1200-x,y));  }   drawVoronoi(); //renders your voronoi   endRaw(); //ends the recording
}