Processing Forum
- Rot r = new Rot(RotOrder.ZYX, 0, radians(90), radians(90));
- Rot r2 = new Rot(RotOrder.ZYX, radians(-90), radians(90), radians(0));
- println(r);
- println(r2);
WARNING: RXTX Version mismatchJar version = RXTX-2.2pre1native lib Version = RXTX-2.2pre2
filepath was a litte bit differentand download rxtx-2.1-7-bins-r2.zip from "Binary" column.goto C:\Users\Downloads\rxtx-2.1-7-bins-r2.zip\rxtx-2.1-7-bins-r2and copy RXTXcomm toC:\Program Files\processing-1.5.1\java\lib\extgoto C:\Users\Downloads\rxtx-2.1-7-bins-r2.zip\rxtx-2.1-7-bins-r2\Windows\i368-mingw32and copy both rxtxParallel.dll and rxtxSerial.dll toC:\Program Files\processing-1.5.1\java\bin
PVector pos;//<start position
void setup(){float p=1.5;//extra variable to simple change sizesize(int(800*p),int( 800*p));
noLoop();background(#ffffff);pos=new PVector(800*p/2,400*p/2);//<start position}//-----------------------------//String L_string = "+F+F+F+F";//String change="F-F+F+FF-F-F+F";String change="FF-F-F-F-F-F+F";int n=3;//iteration number//-----------------------------
int F=int(10); //how long single line is
float THETA=PI/2;
//-------------------------------//-------------------------------void draw(){println(L_string+" <-String in beginning ");for(int i=0;i<n;i=i+1)//n-number of iterations,it generate string{L_string=Make_String(L_string,change);println(L_string+" <-String in end");}
background(#ffffff);draw_String(L_string,THETA,F);}//-------------------------------//-------------------------------
String Make_String(String L_string,String change){//I am creating arrayString[] L_STRING = new String[L_string.length()];//----------------------------------------//fill in arrayfor (int i = 0; i < L_string.length(); i = i+1){L_STRING[i]=""+L_string.charAt(i);
if(L_string.charAt(i)=='F'){L_STRING[i]=change;}}//----------------------------------------int W=L_string.length();//I add new variable because i will change string//it create string from arrayL_string="";for (int i = 0; i < W; i = i+1){L_string=L_string+L_STRING[i];}return(L_string);}//-------------------------------//-------------------------------void draw_String(String L_string,float TETA,int F){
float R=0;
for (int i = 0; i < L_string.length(); i = i+1){//if rotation is multiple of 360 i can remove itif(R>=2*PI){R=R-2*PI;}if(R<-2*PI){R=R+2*PI;}
if(L_string.charAt(i)=='F'){
//extra variablesint x=int(F*cos(R+PI/2));int y= int(F*sin(R+PI/2));
line(pos.x,pos.y,pos.x- x,pos.y-y);pos.x-= x;pos.y-= y;}
if(L_string.charAt(i)=='+'){//turn rightR+=THETA;}
if(L_string.charAt(i)=='-'){//turn leftR-=THETA;}
}print(R);}