I have some points that define an object in 3D space (lets say a pencil) and a vector that tells me the direction the pencil is already pointing to.

I want to know how to make the pencil point to another direction.

so I take a random point of the many that defines the pencil: PencilP =(a,b,c)

the direction the pencil is pointing to: OldD =(x,y,z)

the new direction i want to point to: NewD =(i,j,k)

How do I build the rotation matrix?

Or if there is a faster way to get to the solution I will want to know it too

**Edited by lomateron, 23 February 2013 - 06:39 PM.**