Processsing Snippet
Wednesday, March 17th, 2010-
import processing.pdf.*;
-
-
int pointNum = 14;
-
void setup(){
-
size(500,500, JAVA2D);
-
beginRecord(PDF, "shape.pdf");
-
translate(width / 2, height / 2);
-
background(255);
-
strokeWeight(0.5);
-
smooth();
-
noFill();
-
addPoints();
-
connectPoints();
-
endRecord();
-
}
-
-
void addPoints(){
-
float step = TWO_PI / pointNum;
-
float theta = step / 2;
-
float radius = 200;
-
for (int i = 0; i<pointNum; i++){
-
float x = radius * cos(theta);
-
float y = radius * sin(theta);
-
theta += step;
-
}
-
}
-
void connectPoints(){
-
for (int i = 0; i<pointNum; i++){
-
for (int j = 0; j<pointNum; j++){
-
if (a != b){
-
//if (int(a.x) == int(b.x) || int(a.y) == int(b.y)){
-
line(a.x, a.y, b.x, b.y);
-
// }
-
}
-
}
-
}
-
}
-
-
float x;
-
float y;
-
this.x = x;
-
this.y = y;
-
// ellipse(x,y, 10, 10);
-
}
-
}
Connect the dots, try changing pointNum.
Actually have a good deal more to say about this snippet... maybe in the next day or two.