int f = 1; if (ch('../dispMirror') == 1) f = -1; //DISPLACE POINTS vector a; if (@ptnum == 0) { a = normalize(point(0, "P", @ptnum+1) - point(0, "P", @ptnum)); } if (@ptnum >= 1) { a = normalize(point(0, "P", @ptnum+1) - point(0, "P", @ptnum-1)); } if (@ptnum == npoints(0)-1) { a = normalize(point(0, "P", @ptnum)- point(0, "P", @ptnum-1)); } int rd = int(random(@ptnum)*ch('../dispRand')); @P += set(-a.z, 0, a.x) * ((ch('../dispDist')/2) + rd) * f; //Rotate Points in XZ-Plane //Initialize Up and N vector rotAxis = set(0,1,0); // Set up Vector to Y (we're working on '2D' here) vector N = a; //select the Axis // create a 3x3 orientation matrix using N and up as the principal axes. matrix3 m = maketransform(N, rotAxis); // now rotate this matrix around the N axis float angle_deg = (f * 90) + ch('../rot') + ((random(@ptnum)-.5)*2) * ch('../rotRand'); float angle = radians(angle_deg); rotate(m, angle, rotAxis); p@orient = quaternion(m);