![]() ![]() (In other words, each rotation you can make that satisfies your conditions corresponds to doing the procedure described above followed by another rotation around N.) But if you don't care where in the plane your points wind up, I think this rotation around the common axis is the simplest way to just get the points into the plane you want them in. This corresponds to the fact that, after you take the steps described above, you can then rotate the plane around N, and your points will be in different places while staying in the same plane. This is not unique, of course as mentioned in peterk's answer, there are an infinite number of possible rotations you could make that would transform the plane normal to M into the plane normal to N. Where the function dot performs matrix multiplication. This formula is described on Wikipedia.įor each point, compute its corresponding point on the new plane as newpoint = dot(rmat, point) Where x, y, and z are the components of axis. ![]() As user1318499 pointed out in a comment, this step can cause an error if M = N, unless your implementation of unitcross returns (0,0,0) when a = b.Ĭompute the rotation matrix from the axis and angle as c = costheta unitcross(a, b) = cross(a, b) / norm(cross(a, b)). Where unitcross is a function that performs the cross product and normalizes it to a unit vector, i.e. If M = N you can stop now and leave the original points unchanged.Ĭalculate the rotation angle as costheta = dot(M,N)/(norm(M)*norm(N))Ĭalculate the rotation axis as axis = unitcross(M, N) Let M be the vector normal to your current plane, and N be the vector normal to the plane you want to rotate into.If you have, or can easily compute, the normal vector to the plane that your points are currently in, I think the easiest way to do this will be to rotate around the axis common to the two planes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |