Quaternion from direction

Hey guys, while fidling around with camera and culling, I encoutered this problem: how would I rotate a Quad to match the normal vector of a plane? Or the same thing: given a camera direction how could one compute the Quaternion to rotate a camera node to face in that direction?

Sure, I could solve the equation system from Quaternion.mult( Vector3f ) to compute the Quaternion from the two vectors but that would be quite tedious…

…any suggestions?

I've been doing something like this, where localAim is the direction I want to aim in, normalized. and up is my models up vector, usually 0 1 0



            Vector3f right = up.cross(localAim);

           

            //up = right.cross(localAim); //to ensure ortho, not sure if needed

            Vector3f[] axes =  new Vector3f[] {right, up, localAim};

            Quaternion quat = new Quaternion();

            quat.fromAxes(axes);

            getModel().setLocalRotation(quat);

oh, thanks alot!! - should have found that method myself  ://

And yes, the methods expects orthogonal vectors (says the JavaDoc ;))