-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessingGRBL.pde
More file actions
51 lines (41 loc) · 821 Bytes
/
ProcessingGRBL.pde
File metadata and controls
51 lines (41 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import controlP5.*;
ControlP5 cp5;
int myColor = color(0, 0, 0);
int n = 6;
int d = 72;
PVector points;
void setup() {
size(800, 800);
cp5 = new ControlP5(this);
pushMatrix();
cp5.addSlider("n")
.setPosition(100, 50)
.setRange(0, 100)
;
cp5.addSlider("d")
.setPosition(100, 100)
.setRange(0, 100)
;
popMatrix();
}
void draw() {
background(0);
stroke(255);
strokeWeight(1);
pushMatrix();
translate(width/2, height/2);
noFill();
beginShape();
for (float i = 0; i<361; i++) {
float k = i*d;
float r = 250*sin(n*k);
float x = r * cos(k);
float y = r * sin(k);
points = new PVector(x, y);
curveVertex(points.x, points.y);
String str = "G1 X" + points.x + " " + "Y" + points.y;
println(str);
}
endShape(CLOSE);
popMatrix();
}