Given a 3D plane and an arbitrary point on it that I want to consider the origin (0,0,0)
of a new basis, it is possible to: (A) define a basis from this information? And (B) create a transformation matrix that allows me to convert between world space and the new basis?
I can assume the transformation is affine.
Thanks very much!
The short answer is yes, but since you only have a plane the orientation of the new basis will be arbitrary.
Lets say you have a point k that lies on the plane P and you want point k as your origin. You have P = (N, d) where N is the normalised plane normal and d is the distance to the plane from the origin.
To determine an orthonormal basis with arbitrary orientation on this plane Define 3 vectors right R, up U and normal N
We already have N which is nothing but the normal of the plane
U = (0,1,0)
// If U is pointing in almost the same direction as N, change it
if (U.N > 0.7071) U = (0, 0, 1);
R = normalise (U x N)
U = normalise (N x R) // U was not orthonormal
Now define a 3x3 transformation matrix M where the 3 rows of the matrix are R, U and N respectively.
R
M = ( U )
N
Now let us say you wanted to transform a point p to a point p' on your plane.
p' = M ( p - k )
If you want to do all this with one matrix you can combine M and the translation vector -k into a 4x4 homogeneous matrix. Notes:
HTH