public
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/rikrd/geomerative.git
name age message
file .classpath Sun Jul 27 14:04:59 -0700 2008 removing warnings that Eclipse gave, mainly non... [markluffel]
file .gitignore Sat Oct 18 04:08:23 -0700 2008 added build, distribution and library to git un... [rikrd]
file .project Sun Jul 27 13:50:42 -0700 2008 fixing issue with FastRClip, using it by defaul... [markluffel]
file CHANGELOG Wed Nov 05 05:04:29 -0800 2008 added a CHANGELOG fixed the bug where binary op... [Ricard Marxer]
file COPYING Sat May 10 07:22:44 -0700 2008 added COPYING renamed README [rikrd]
file HANDBOOK Sat Aug 09 05:25:16 -0700 2008 updated method names [rikrd]
file Makefile Mon Jun 29 10:58:34 -0700 2009 update a revision [rikrd]
file README Fri Jun 27 14:54:40 -0700 2008 removed the TODO section, it belongs to README [rikrd]
file TODO Wed Nov 05 05:11:24 -0800 2008 added a possible method fitIn() [Ricard Marxer]
directory data/ Sat Oct 18 03:45:20 -0700 2008 added example svg in a separate dir [rikrd]
directory examples/ Sun Dec 07 08:04:00 -0800 2008 clean up a bit the Makefile added Florian's exa... [Ricard Marxer]
directory external/ Sat Jul 05 13:36:15 -0700 2008 moving the linux build scripts into the Makefile [markluffel]
file geomerative-javadoc.xml Mon May 18 04:52:31 -0700 2009 more fixes to the documentation [Ricard Marxer]
directory old_tutorials/ Wed Feb 25 08:48:49 -0800 2009 moved old tutorials out of the distribution fix... [Ricard Marxer]
directory src/ Sun Jun 28 11:51:29 -0700 2009 add direct access to he style (getStyle()) like... [rikrd]
file stylesheet.css Sat May 16 01:45:04 -0700 2009 add the ant file to build the javadoc and the s... [rikrd]
directory templates/ Sun May 04 15:07:14 -0700 2008 remade the web and updated the revision number [rikrd]
directory test/ Sun Jul 27 14:04:59 -0700 2008 removing warnings that Eclipse gave, mainly non... [markluffel]
file todo.txt Mon Oct 06 07:48:15 -0700 2008 finished off the renaming subshape -> path [rikrd]
directory tutorial/ Fri Jun 12 02:58:03 -0700 2009 removed an unnecessary svg [Ricard Marxer]
directory web/ Mon Jun 29 10:58:34 -0700 2009 update a revision [rikrd]
README
COPYRIGHT
---------------

Copyright 2006-2008 Ricard Marxer <email@ricardmarxer.com>

This product includes software developed by the Solution Engineering, Inc. (http://www.seisw.com/).

This product includes software developed by the The Apache Software Foundation (http://www.apache.org/).


INSTALL
---------------
Unzip the geomerative-XX.zip in the Processing libraries directory.
The result shoul look like this:
/path/to/processing/libraries/geomerative/library/geomerative.jar

USAGE
---------------
In the Processing IDE Sketch > Import Library > geomerative

DOCUMENTATION
---------------
The documentation is in the documentation folder.  Just open the index.html with any web browser.

MINI-TUTORIAL
---------------
This geometry library consists of three main classes:

RShape    - Contains subshapes formed of commands (move,lines,beziers,...)
RPolygon  - Contains contours formed of points
RMesh    - Contains strips formed of vertices

There are several uses of the library:

+ Draw shapes with holes, in order to do so, we create a new shape and add commands to it.  Once the shape is created we 
can:
  - draw it using draw(g) (note the use of g in order to draw the shape to the main PGraphics object)
  - convert it to a polygon using toPolygon()
  - acces its subshapes' commands or the points of these commands, accesing its attribute subshapes and the RSubshape 
  methods

+ Draw polygons with holes, in order to do so, we create a new polygon and add points (addPoint(x,y)) or contours 
(addContour()) to it.  Once the polygon is created we can:
  - draw it using draw(g)
  - convert it to a mesh using toMesh()
  - acces its contours' points, accesing its attribute contours and the RContour methods
  - do binary operations over two polygons, using the methods diff(), union(), xor() and intersection()

EXAMPLE
--------------

/// Example to draw a simple shape with a hole
/// Converting the shape to a mesh in the setup() avoids having to tesselate it for each frame, therefore the use of 
RMesh
import geomerative.*;

RPolygon p;
RShape s;
RMesh m;
int t = 0;

void setup(){
  size(100,100,P3D);
  framerate(34);
  background(255);
  fill(0);
  //noFill();
  stroke(255,0,0);
  
  s = new RShape();
  
  s.addMoveTo(-30,250);
  s.addLineTo(30,150);
  s.addArcTo(50,75,100,30);
  s.addBezierTo(130,90,75,100,90,150);
  s.addLineTo(130,250);
  s.addBezierTo(80,200,70,200,-30,250);
  
  s.addMoveTo(60,120);
  s.addBezierTo(75,110,85,130,75,140);
  s.addBezierTo(70,150,65,140,60,120);
  
  p = s.toPolygon(100);
  m = p.toMesh();
}

void draw(){
  scale(0.25);
  translate(200,50);
  background(255);
  
  rotateY(PI/65*t);
  fill(0);
  m.draw(g);
  
  rotateY(PI/64*t);
  noFill();
  p.draw(g);
  t++;
}
/// End of example


/// Example calculating the difference of two polygons
/// Note the use of predefined polygons (createStar(), createCircle(), createRing(),...)
import geomerative.*;

RMesh m;
RPolygon p = RPolygon.createStar(120,70,6);
RPolygon p2 = RPolygon.createStar(60,50,30);

float t=0;

void setup(){
  size(400,400,P3D);
  framerate(24);
  //smooth();
  noStroke();
  fill(0);
  
  p=p.diff(p2);
  m = p.toMesh();
}

void draw(){ 
  background(255);
  translate(width/2,height/2);

  rotateX(t/39);
  m.draw(g);
  
  rotateY(-t/5);
  scale(0.3);
  m.draw(g);
  
  t++;
}
/// End of example



KNOWN ISSUES
-------------

- Under certain renderers there's a big loss of precision, resulting in really ugly renderings of fonts and polygons in 
general.
- When we decrease the font size we get bad results, bad shapes.  This must have to do with the font fixed point 
arithmetics, haven't studied any of that yet.