File tree 1 file changed +36
-0
lines changed
Demos/Graphics/GetTessGroups
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // GetTessGroups, by Andres Colubri
2
+ // The getTessellation() function in Processing 4 returns a group shape
3
+ // where the first shape contains only the fill geometry, the second,
4
+ // the stroke lines, and third, only the points (if any).
5
+
6
+ PShape box;
7
+ PShape tess;
8
+
9
+ boolean onlyStrokeLines = false ;
10
+
11
+ void setup () {
12
+ size (600 , 600 , P3D );
13
+
14
+ strokeWeight (5 );
15
+ box = createShape(BOX , 200 );
16
+
17
+ tess = box. getTessellation();
18
+ }
19
+
20
+ void draw () {
21
+ background (180 );
22
+ lights ();
23
+
24
+ translate (width / 2 , height / 2 );
25
+ rotateX (frameCount * 0.01 );
26
+ rotateY (frameCount * 0.01 );
27
+ for (int i = 0 ; i < tess. getChildCount(); i++ ) {
28
+ if (! onlyStrokeLines || i == 1 ) {
29
+ shape (tess. getChild(i));
30
+ }
31
+ }
32
+ }
33
+
34
+ void keyPressed () {
35
+ onlyStrokeLines = ! onlyStrokeLines;
36
+ }
You can’t perform that action at this time.
0 commit comments