I'm sure this is bread and butter stuff, but I'm struggling to work out how to do this. My objective is to calculate a new point based on the rotation of a Vector. This diagram hopefully will help explain:
* P1
.
.
.
.
O.--------------> N
.
.
.
.
* P0
As a given I have the Vector P0->O and the normal N. Also, there is a Transform3D centred at P0. The objective is move this Transform3D so it is centred at P1. Now the angle P0-O-N can be computed using somthing like:
// These are givens.
Point3f P0 = ...;
Point3f O = ...;
Point3f N = ...;
// Get input vector.
Vector3f iv = new Vector3f(O.x - P0.x, O.y - P0.y, O.z - P0.z);
Vector3f nm = new Vector3f(N.x - O.x, N.y - O.y, N.z - O.z);
// Compute angle P0-O-N.
float angle = iv.angle(nm);
// Save angle P0-O-P1.
angle *= 2;
At this point I now have an angle, and two Vectors (iv and nm) that define a plane. What I want to do is to rotate iv, in this plane, so it becomes the Vector O-P1. Then I can compute the point P1. But how do I do this? Every time I try to use a rotation it affects the upper 3x3 matrix, but the position P0 which is stored in the forth column so its values are never touched.
Can anyone please give me some hints?