Geomerative subshapes = deprecated
in
Contributed Library Questions
•
2 years ago
Hi.
I'm trying to learn and understand the Geomerative library, but the examples I am working with use some code from an older version of the library.
Specifically I am looking for the new syntax for the subshapes variable:
http://www.ricardmarxer.com/old_geomerative/documentation/rshape_class_rshape.htm
Which I can't seem to locate in the new documentation. Here is the context:
http://www.lulu.com/product/paperback/type-+-code-processing-for-designers/4430589
any help would be greatly appreciated.
thanks
I'm trying to learn and understand the Geomerative library, but the examples I am working with use some code from an older version of the library.
Specifically I am looking for the new syntax for the subshapes variable:
http://www.ricardmarxer.com/old_geomerative/documentation/rshape_class_rshape.htm
Which I can't seem to locate in the new documentation. Here is the context:
- import geomerative.*;
PFont font;
RFont f;
RGroup grp;
RShape s;
float len;
float angle;
float pos;
//------------------------ Runtime properties ----------------------------------
// Save each frame
boolean SAVEVIDEO = false;
boolean SAVEFRAME = true;
boolean APPLICATION = false;
String DEFAULTAPPLETRENDERER = JAVA2D;
int DEFAULTAPPLETWIDTH =600;
int DEFAULTAPPLETHEIGHT =600;
String DEFAULTAPPLICRENDERER = OPENGL;
int DEFAULTAPPLICWIDTH = 600;
int DEFAULTAPPLICHEIGHT =600;
//------------------------------------------------------------------------------
// The error range for the tangent position and angle
float ANGLEERROR = 0.1;
float POINTERROR = 0;
// The length variation of the tangnet
// -> 500: sketchy, blueprint
// -> 150: light blueprint
// -> 2000: mystic
float LENGTHTANGENT = 30;
// The initial text
String STRNG = "S";
String FONT = "arial.ttf";
// The alpha value of the lines
int ALPHAVALUE = 2;
// The velocity of the calligraphy
int VELOCITY = 1;
int MARGIN = 1;
String newString = "";
void setup(){
int w = DEFAULTAPPLICWIDTH, h = DEFAULTAPPLICHEIGHT;
String r = DEFAULTAPPLICRENDERER;
if(!APPLICATION){
// Specify the widtha and height at runtime
w = int(param("width"));
h = int(param("height"));
r = (String)param("renderer");
// (String) will return null if param("renderer") doesn't exist
if (r != OPENGL && r != P3D && r != JAVA2D && r != P2D) {
r = DEFAULTAPPLETRENDERER;
}
// int() will return 0 if param("width") doesn't exist
if (w <= 0) {
w = DEFAULTAPPLETWIDTH;
}
// int() will return 0 if param("height") doesn't exist
if (h <= 0) {
h = DEFAULTAPPLETHEIGHT;
}
}
size(w,h,r);
background(255);
frameRate(25);
LENGTHTANGENT = LENGTHTANGENT * width/800F;
try{
smooth();
}catch(Exception e){}
noFill();
stroke(0, 0, 0,80);
noFill();
//f = new RFont(this, FONT, 372, RFont.CENTER);
RG.init(this);
f = new RFont(FONT, 372, RFont.CENTER);
initialize();
}
void draw(){
pushMatrix();
translate(width/2,height/2);
// Draw very low alpha and long tangents on random points of each letters
for(int i=0;i<grp.countElements();i++){
s = (RShape)(grp.elements[i]);
for(int j=0;j<s.countChildren();j++){
for(int k=0;k<VELOCITY;k++){
pos = random(0, 1);
RPoint tg = s.subshapes[j].getCurveTangent(pos);
RPoint p = s.subshapes[j].getCurvePoint(pos);
p.x = p.x + random(-POINTERROR,POINTERROR);
p.y = p.y + random(-POINTERROR,POINTERROR);
len = random(-LENGTHTANGENT, LENGTHTANGENT);
angle = atan2(tg.y, tg.x) + random(-ANGLEERROR, ANGLEERROR);
bezier(p.x,p.y,10,10,90,90,15,80);
}
}
}
popMatrix();
if(keyCode==ENTER){
STRNG = newString;
newString = "";
initialize();
}else if(keyCode==BACKSPACE){
if(newString.length() !=0 ){
newString = newString.substring(0,newString.length()-1);
}
}else if(keyCode!=SHIFT){
newString += key;
}
}
void initialize(){
grp = f.toGroup(STRNG);
grp.centerIn(g,MARGIN,1,1);
background(255);
}
http://www.lulu.com/product/paperback/type-+-code-processing-for-designers/4430589
any help would be greatly appreciated.
thanks
1