What you'll need to do is take the cross product of your input vector 
and the axis you want to point along the input vector. 
Quote:PVector axis = new PVector(0, 0, 1);
PVector crss = input.cross(axis);
 
The cross-product has the nifty property of being perpendicular to both your input vector and the z-axis. What this means is that you can rotate your coordinate system about crss, by the angle between your input and the z axis, and the two will then line up. 
Quote:float theAngle = PVector.angleBetween(input, axis);
crss.normalize();
rotate(-theAngle, crss.x, crss.y, crss.z);
 
Of course, you'll need this rotate function to rotate around an arbitrary axis (math from the OpenGL Red Book): 
Quote:void rotate (float r, float x, float y, float z) {
  float d = sqrt(x*x+y*y+z*z);
  float a = x/d, b = y/d, c = z/d;
  float t[][]={{a*a,a*b,a*c},{b*a,b*b,b*c},{c*a,c*b,c*c}};
  float s[][]={{0,-c,b},{c,0,-a},{-b,a,0}};
  float cosr=cos(r);
  float sinr=sin(r);
  float m[][]={{1,0,0},{0,1,0},{0,0,1}};
  for (int i=0; i<3; i++) {
     for (int j=0; j<3; j++) {
        m[i][j] = t[i][j] + cosr*(m[i][j]-t[i][j])+sinr*s[i][j];
     }
  }
  
  applyMatrix (m[0][0],m[0][1],m[0][2],0,
                      m[1][0],m[1][1],m[1][2],0,
                      m[2][0],m[2][1],m[2][2],0,
                      0,0,0,1);
}