public
Fork of rikrd/geomerative
Description: Geomerative is a library for Processing. It extends 2D geometry operations to facilitate generative geometry. Includes a TrueType font and an SVG interpreters. This library exposes the shapes (such as vector drawings or typographies) in a more approchable way. Geomerative makes it easy to access the contours, the control points and the curve points, making it easy to develop generative typography and geometry pieces in Processing.
Homepage: http://www.ricardmarxer.com/geomerative
Clone URL: git://github.com/markluffel/geomerative.git
geomerative / HANDBOOK
100644 66 lines (32 sloc) 1.797 kb
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
By now Geomerative will maintain its focus on trying to create an easy yet powerful API to generative geometry:
 
* accessing points
* accessing measures (centroids, area, inside points, holes,...)
* transforming
* performing geometric operations on shapes.
 
 
 
1- Allways initialize the library before any use of it:
 
void setup(){
  size(300, 400);
  RGeomerative.init(this);
 
  // the rest
}
 
 
 
 
 
2- All classes with arrays such as elements[] in RGroup and subshapes[] in RShape) have a helper method starting with "count" that allow not to check for the validity of the array:
 
for ( int i = 0 ; i < myGroup.countElements() ; i++ ) {
  // do something with myShape.elements[i]
}
 
for ( int i = 0 ; i < myShape.countSubshapes() ; i++ ) {
  // do something with myShape.subshapes[i]
}
 
 
 
 
 
 
3- All shapes geometric classes accept transformations methods like:
 
myGroup.scale(1.2);
 
myShape.rotate(PI_HALF);
 
mySubshape.translate(20, 30);
 
 
 
 
 
4- You may access the control points of a shape by using getPoints() and points on the curve by using getCurvePoints(). The arrays returned are the actual points so if the points get modified the shapes are modified aswell.
 
RPoint[] myControlPoints = myShape.getHandles();
RPoint[] myPoints = myGroup.getPoints();
 
 
TODO:
5- Sometimes it's useful to get points of the different contours separately, in that case we would use getPaths() and getCurvePaths(). These methods are similar to the others but return an array of arrays of RPoint.
 
RPoint[][] myControlPaths = myShape.getHandlePaths();
RPoint[][] myPointPaths = myShape.getPointPaths();
 
6- In some even more rare cases we might want to access the tangets of the curves. In that case we use.
 
RPoint[] myTangents = myShape.getTangents();
RPoint[][] myTangentPaths = myShape.getTangentPaths();