Skip to content

Commit d32ae06

Browse files
committed
Added 2.x distribution
1 parent c141425 commit d32ae06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+18635
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## How to install GenerativeDesign
2+
3+
### Install with the Contribution Manager
4+
5+
Add contributed Libraries by selecting the menu item _Sketch__Import Library...__Add Library..._ This will open the Contribution Manager, where you can browse for GenerativeDesign, or any other Library you want to install.
6+
7+
Not all available Libraries have been converted to show up in this menu. If a Library isn't there, it will need to be installed manually by following the instructions below.
8+
9+
### Manual Install
10+
11+
Contributed Libraries may be downloaded separately and manually placed within the `libraries` folder of your Processing sketchbook. To find (and change) the Processing sketchbook location on your computer, open the Preferences window from the Processing application (PDE) and look for the "Sketchbook location" item at the top.
12+
13+
By default the following locations are used for your sketchbook folder:
14+
* For Mac users, the sketchbook folder is located inside `~/Documents/Processing`
15+
* For Windows users, the sketchbook folder is located inside `My Documents/Processing`
16+
17+
Download GenerativeDesign from http://www.generative-gestaltung.de/
18+
19+
Unzip and copy the contributed Library's folder into the `libraries` folder in the Processing sketchbook. You will need to create this `libraries` folder if it does not exist.
20+
21+
The folder structure for Library GenerativeDesign should be as follows:
22+
23+
```
24+
Processing
25+
libraries
26+
GenerativeDesign
27+
examples
28+
library
29+
GenerativeDesign.jar
30+
reference
31+
src
32+
```
33+
34+
Some folders like `examples` or `src` might be missing. After Library GenerativeDesign has been successfully installed, restart the Processing application.
35+
36+
### Troubleshooting
37+
38+
If you're having trouble, have a look at the [Processing Wiki](https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library) for more information, or contact the author [Benedikt Gross, Hartmut Bohnacker](http://www.generative-gestaltung.de/).
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# More on this file here: https://github.com/processing/processing/wiki/Library-Basics
2+
# UTF-8 supported.
3+
4+
# The name of your Library as you want it formatted.
5+
name = GenerativeDesign
6+
7+
# List of authors. Links can be provided using the syntax [author name](url).
8+
authors = [Benedikt Gross, Hartmut Bohnacker](http://www.generative-gestaltung.de/)
9+
10+
# A web page for your Library, NOT a direct link to where to download it.
11+
url = http://www.generative-gestaltung.de/
12+
13+
# The category (or categories) of your Library, must be from the following list:
14+
# "3D" "Animation" "Compilations" "Data"
15+
# "Fabrication" "Geometry" "GUI" "Hardware"
16+
# "I/O" "Language" "Math" "Simulation"
17+
# "Sound" "Utilities" "Typography" "Video & Vision"
18+
#
19+
# If a value other than those listed is used, your Library will listed as
20+
# "Other". Many categories must be comma-separated.
21+
categories = ${library.categories}
22+
23+
# A short sentence (or fragment) to summarize the Library's function. This will
24+
# be shown from inside the PDE when the Library is being installed. Avoid
25+
# repeating the name of your Library here. Also, avoid saying anything redundant
26+
# like mentioning that it's a Library. This should start with a capitalized
27+
# letter, and end with a period.
28+
sentence = A collection of various functions belonging to the book GENERATIVE DESIGN (english), GENERATIVE GESTALTUNG (german) and DESIGN GENERATIF (french).
29+
30+
# Additional information suitable for the Processing website. The value of
31+
# 'sentence' always will be prepended, so you should start by writing the
32+
# second sentence here. If your Library only works on certain operating systems,
33+
# mention it here.
34+
paragraph = It supplies classes and functions for 3d-surfaces, simple physics (nodes, springs, attractors), graphic tablets, ASE-export or asynchronous loading of xml, html and images.
35+
36+
# Links in the 'sentence' and 'paragraph' attributes can be inserted using the
37+
# same syntax as for authors.
38+
# That is, [here is a link to Processing](http://processing.org/)
39+
40+
# A version number that increments once with each release. This is used to
41+
# compare different versions of the same Library, and check if an update is
42+
# available. You should think of it as a counter, counting the total number of
43+
# releases you've had.
44+
version = 6 # This must be parsable as an int
45+
46+
# The version as the user will see it. If blank, the version attribute will be
47+
# used here. This should be a single word, with no spaces.
48+
prettyVersion = 1.0.5 # This is treated as a String
49+
50+
# The min and max revision of Processing compatible with your Library.
51+
# Note that these fields use the revision and not the version of Processing,
52+
# parsable as an int. For example, the revision number for 2.2.1 is 227.
53+
# You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt
54+
# Only use maxRevision (or minRevision), when your Library is known to
55+
# break in a later (or earlier) release. Otherwise, use the default value 0.
56+
minRevision = 0
57+
maxRevision = 227
Binary file not shown.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# More on this file here: https://github.com/processing/processing/wiki/Library-Basics
2+
# UTF-8 supported.
3+
4+
# The name of your Library as you want it formatted.
5+
name = GenerativeDesign
6+
7+
# List of authors. Links can be provided using the syntax [author name](url).
8+
authors = [Benedikt Gross, Hartmut Bohnacker](http://www.generative-gestaltung.de/)
9+
10+
# A web page for your Library, NOT a direct link to where to download it.
11+
url = http://www.generative-gestaltung.de/
12+
13+
# The category (or categories) of your Library, must be from the following list:
14+
# "3D" "Animation" "Compilations" "Data"
15+
# "Fabrication" "Geometry" "GUI" "Hardware"
16+
# "I/O" "Language" "Math" "Simulation"
17+
# "Sound" "Utilities" "Typography" "Video & Vision"
18+
#
19+
# If a value other than those listed is used, your Library will listed as
20+
# "Other". Many categories must be comma-separated.
21+
categories = ${library.categories}
22+
23+
# A short sentence (or fragment) to summarize the Library's function. This will
24+
# be shown from inside the PDE when the Library is being installed. Avoid
25+
# repeating the name of your Library here. Also, avoid saying anything redundant
26+
# like mentioning that it's a Library. This should start with a capitalized
27+
# letter, and end with a period.
28+
sentence = A collection of various functions belonging to the book GENERATIVE DESIGN (english), GENERATIVE GESTALTUNG (german) and DESIGN GENERATIF (french).
29+
30+
# Additional information suitable for the Processing website. The value of
31+
# 'sentence' always will be prepended, so you should start by writing the
32+
# second sentence here. If your Library only works on certain operating systems,
33+
# mention it here.
34+
paragraph = It supplies classes and functions for 3d-surfaces, simple physics (nodes, springs, attractors), graphic tablets, ASE-export or asynchronous loading of xml, html and images.
35+
36+
# Links in the 'sentence' and 'paragraph' attributes can be inserted using the
37+
# same syntax as for authors.
38+
# That is, [here is a link to Processing](http://processing.org/)
39+
40+
# A version number that increments once with each release. This is used to
41+
# compare different versions of the same Library, and check if an update is
42+
# available. You should think of it as a counter, counting the total number of
43+
# releases you've had.
44+
version = 6 # This must be parsable as an int
45+
46+
# The version as the user will see it. If blank, the version attribute will be
47+
# used here. This should be a single word, with no spaces.
48+
prettyVersion = 1.0.5 # This is treated as a String
49+
50+
# The min and max revision of Processing compatible with your Library.
51+
# Note that these fields use the revision and not the version of Processing,
52+
# parsable as an int. For example, the revision number for 2.2.1 is 227.
53+
# You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt
54+
# Only use maxRevision (or minRevision), when your Library is known to
55+
# break in a later (or earlier) release. Otherwise, use the default value 0.
56+
minRevision = 0
57+
maxRevision = 227
Binary file not shown.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* part of the example files of the generativedesign library.
3+
*
4+
* shows how to use the mesh class, if you want to define your own forms.
5+
*/
6+
7+
8+
// imports
9+
import generativedesign.*;
10+
import processing.opengl.*;
11+
12+
// mesh
13+
MyOwnMesh myMesh;
14+
15+
16+
void setup() {
17+
size(1000,1000,OPENGL);
18+
19+
// setup drawing style
20+
colorMode(HSB, 360, 100, 100, 100);
21+
noStroke();
22+
23+
// initialize mesh. class MyOwnMesh is defined below
24+
myMesh = new MyOwnMesh(this);
25+
myMesh.setUCount(100);
26+
myMesh.setVCount(100);
27+
myMesh.setColorRange(193, 193, 30, 30, 85, 85, 100);
28+
myMesh.update();
29+
}
30+
31+
32+
void draw() {
33+
background(255);
34+
35+
// setup lights
36+
colorMode(RGB, 255, 255, 255, 100);
37+
lightSpecular(255, 255, 255);
38+
directionalLight(255, 255, 255, 1, 1, -1);
39+
shininess(5.0);
40+
41+
// setup view
42+
translate(width*0.5, height*0.5);
43+
scale(180);
44+
rotateX(radians(10));
45+
rotateY(radians(-10));
46+
47+
// recalculate points and draw mesh
48+
myMesh.draw();
49+
}
50+
51+
52+
53+
// define your own class that extends the Mesh class
54+
class MyOwnMesh extends Mesh {
55+
56+
MyOwnMesh(PApplet theParent) {
57+
super(theParent);
58+
}
59+
60+
// just override this function and put your own formulas inside
61+
PVector calculatePoints(float u, float v) {
62+
float A = 2/3.0;
63+
float B = sqrt(2);
64+
65+
float x = A * (cos(u) * cos(2*v) + B * sin(u) * cos(v)) * cos(u) / (B - sin(2*u) * sin(3*v));
66+
float y = A * (cos(u) * sin(2*v) - B * sin(u) * sin(v)) * cos(u) / (B - sin(2*u) * sin(3*v));
67+
float z = B * cos(u) * cos(u) / (B - sin(2*u) * sin(3*v));
68+
69+
return new PVector(x, y, z);
70+
}
71+
}
72+
73+
74+
75+
76+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* part of the example files of the generativedesign library.
3+
*
4+
* shows how to use the Mesh class.
5+
*/
6+
7+
8+
// imports
9+
import generativedesign.*;
10+
import processing.opengl.*;
11+
12+
13+
void setup() {
14+
size(1000,1000,OPENGL);
15+
16+
// setup drawing style
17+
background(255);
18+
noStroke();
19+
fill(0);
20+
21+
// setup lights
22+
lightSpecular(230, 230, 230);
23+
directionalLight(200, 200, 200, 0.5, 0.5, -1);
24+
specular(color(220));
25+
shininess(5.0);
26+
27+
// setup view
28+
translate(width*0.5, height*0.5);
29+
rotateX(-0.2);
30+
rotateY(-0.5);
31+
scale(100);
32+
33+
34+
// setup Mesh, set colors and draw
35+
Mesh myMesh = new Mesh(this, Mesh.STEINBACHSCREW, 200, 200, -3.0, 3.0, -PI, PI);
36+
myMesh.setColorRange(200, 200, 50, 50, 40, 40, 100);
37+
myMesh.draw();
38+
39+
}
40+
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/**
2+
* part of the example files of the generativedesign library.
3+
*
4+
* shows how to use the classes Node, Spring and Attractor in 3d space.
5+
*/
6+
7+
import generativedesign.*;
8+
import processing.opengl.*;
9+
10+
Node nodeA, nodeB;
11+
Spring spring;
12+
Attractor attractor;
13+
14+
15+
void setup() {
16+
size(512, 512, OPENGL);
17+
lights();
18+
19+
// smooth();
20+
fill(0);
21+
22+
nodeA = new Node(random(width), random(height), random(-200, 200));
23+
nodeB = new Node(random(width), random(height), random(-200, 200));
24+
nodeA.setStrength(-2);
25+
nodeB.setStrength(-2);
26+
nodeA.setDamping(0.1);
27+
nodeB.setDamping(0.1);
28+
nodeA.setBoundary(0, 0, -300, width, height, 300);
29+
nodeB.setBoundary(0, 0, -300, width, height, 300);
30+
31+
spring = new Spring(nodeA, nodeB);
32+
spring.setStiffness(0.7);
33+
spring.setDamping(0.9);
34+
spring.setLength(100);
35+
36+
attractor = new Attractor(width/2, height/2, 0);
37+
attractor.setMode(Attractor.SMOOTH);
38+
attractor.setRadius(200);
39+
attractor.setStrength(5);
40+
}
41+
42+
43+
void draw() {
44+
background(255);
45+
46+
if (mousePressed == true) {
47+
nodeA.x = mouseX;
48+
nodeA.y = mouseY;
49+
nodeA.z = mouseY - 256;
50+
}
51+
52+
// attraction between nodes
53+
nodeA.attract(nodeB);
54+
nodeB.attract(nodeA);
55+
56+
57+
// update spring
58+
spring.update();
59+
60+
// attract
61+
attractor.attract(nodeA);
62+
attractor.attract(nodeB);
63+
64+
// update node positions
65+
nodeA.update();
66+
nodeB.update();
67+
68+
69+
// draw attractor
70+
stroke(0, 50);
71+
strokeWeight(1);
72+
noFill();
73+
line(attractor.x-10, attractor.y, attractor.x+10, attractor.y);
74+
line(attractor.x, attractor.y-10, attractor.x, attractor.y+10);
75+
ellipse(attractor.x, attractor.y, attractor.radius*2, attractor.radius*2);
76+
77+
// draw spring
78+
stroke(255, 0, 0, 255);
79+
strokeWeight(4);
80+
line(nodeA.x, nodeA.y, nodeA.z, nodeB.x, nodeB.y, nodeB.z);
81+
82+
// draw nodes
83+
noStroke();
84+
fill(0);
85+
86+
pushMatrix();
87+
translate(nodeA.x, nodeA.y, nodeA.z);
88+
sphere(20);
89+
popMatrix();
90+
91+
pushMatrix();
92+
translate(nodeB.x, nodeB.y, nodeB.z);
93+
sphere(20);
94+
popMatrix();
95+
96+
}
97+
98+
99+
100+
101+
102+
103+
104+

0 commit comments

Comments
 (0)