//import processing.opengl.*; //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // Written by v3ga - http://www.v3ga.net // Updated to processing 118 by Martin Antolini //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- int W=500; int H=275; Branch[] BranchArray; Tree[] TreeArray; int TreeNb, TreeIndex=-1; PFont Font,Font_; int startDragX, startDragY; float rY0,rY, rYspeed, rX; float rxTarget,ryTarget; float y,z,yTarget,zTarget,yStart,zStart,yDest,zDest; Spline testSpline; Spline tmpSpline; float tmpAngle; //---------------------------- // setup() //---------------------------- void setup() { size(W,H,P3D/*,OPENGL*/); rectMode(CENTER); TreeNb = 4; TreeArray = new Tree[TreeNb]; String Wordz0[] = { "++++", "++++", "++++", "++++", "++++", "++++", "++++", "++++","++++", "++++", "++++", "++++" }; TreeArray[0] = new Tree(Wordz0); String Wordz1[] = { "Tentacle>01", "Tentacle>02", "Tentacle>03", "Tentacle>04", "Tentacle>05", "Tentacle>06", "Tentacle>07", "Tentacle>08", "Tentacle>09" }; TreeArray[1] = new Tree(Wordz1); String Wordz2[] = { "Made with", "Processing", "by -v3ga-", "in March 2003" }; TreeArray[2] = new Tree(Wordz2); String Wordz3[] = { "A collection of ", "Processing", "sketches", "2002 - 2003", "programmed by", "v3ga", "converted to Beta","by Martin Antolini" }; TreeArray[3] = new Tree(Wordz3); Font = loadFont("Meta-Bold.vlw"); Font_ = loadFont("Meta.vlw"); fill(180,180,180); stroke(180,180,180); // smooth(); noFill(); yStart = 600.0; yDest = 10.0; yTarget = yDest; y = yStart; zStart = -1500.0; zDest = -565.0; zTarget = zDest; z = zStart; rX = -PI/6; rxTarget = rX; rYspeed = -PI/200; for (int i=0 ; i=length[i-1] && l<=length[i]) { uStart = ((float)(i-1))*ARCLENGTH_STEP; dl = length[i] - length[i-1]; u = ((l - length[i-1])/dl)*ARCLENGTH_STEP + uStart; break; } } pushMatrix(); normalX = getTangentX(u); normalY = getTangentY(u); normalX /= norm(normalX , normalY) ; alpha = (float) Math.acos(normalX); if (normalY<0) alpha = -alpha; translate(getX(u),getY(u)); rotateZ(alpha); fill(255,0,0); textFont(Font, 20); text(Word.charAt(c), 0.0, 5.0); popMatrix(); } void DrawWord() { getLengthSamples(); for (int n=0 ; n360) txtAngle -= 360; pushMatrix(); rotateY(this.rYstart); stroke(200); noFill(); bezier(CurvePoints[0], CurvePoints[1], CurvePoints[2], CurvePoints[3], CurvePoints[4], CurvePoints[5], CurvePoints[6], CurvePoints[7]); splineWord.DrawCurve(); splineWord.DrawWord(); popMatrix(); } } //---------------------------- // class Tree //---------------------------- class Tree { Branch[] mBranch; int mBranchNb; Tree(String[] w) { this.mBranchNb = w.length; this.mBranch = new Branch[mBranchNb]; for (int i=0; ihi) return hi; return val; } int Math_Clip(int val, int lo, int hi) { if (valhi) return hi; return val; } float Math_abs(float val) { if (val > 0.0) return val; if (val < 0.0) return -val; return val; } float norm(float x, float y) { return sqrt(x*x + y*y); }