I am crossposting this question from Stack Overflow since it is more math then programming related.
In Reference to my question about projecting a planar Polygon to a plane, i came to another problem.
I want to project a base contour which is aligned to the x-y-plane along a projection vector from from a point P1 to a point P2. This already works, but now i also need to change the alignment of my base contour using the position of P1 and two vectors defining the new alignement base's x and y should be transformed to.
I want to use a transformation matrix M for this, which premultiplied to my projecton matrix p should give me the transformation matrix from a vertex v in the base contour to a vertex v' on the projection plane such as
v' = (P x M) * v
So, my question is:
How to create a transformation matrix which transforms a vertex v relative to a coordinate system with O = (0,0,0), xdir = (1,0,0), and ydir = (0,1,0) to a vertex relative to a coordinate system with O'=(ox, oy, oz) and xdir and ydir as two arbitrary perpendicular unit vectors?
- I use 4x4 matrices