"Matt J" wrote in message <firstname.lastname@example.org>... > "Myles" wrote in message <email@example.com>... > > > > I've just checked a few points - they're not EXACTLY on the plane, but their distance from the plane is within 0.1 accurate - will this make a large difference? > ============= > > No, the points are simply being rotated, so the 0.1 discrepancy will remain after the transformation. > > In any case, when I run the code below, everything seems fine to me. As you can see, NewPoints, which is composed of your p1,p2,p3, and your two test points, get rotated into a plane highly parallel to the xy-plane. So everything seems to work. Notice that the z-coordinate of all of the resulting points are ~-7.50. Obviously, you haven't given me all your points, but any points not behaving as below would have to be highly non-coplanar with p1,p2,p3 (which you could easily check). > > > > p1 = [21.4137 35.4495 25.3937]; > p2 = [20.9058 23.6485 20.8531]; > p3 = [13.2902 27.3318 20.8531]; > > tp1=[22.3129 34.3892 25.2255]; > tp2=[22.6382 34.4658 25.2255]; > > Ztilt = [0.1682 0.3477 -0.9224]; > > > YourPoints=[p1;p2;p3;tp1;tp2].'; > > u = cross(Ztilt, [0 0 1]); > deg=atan2(norm(u),Ztilt(3))*180/pi; > > NewPoints = AxelRot(YourPoints, deg, u, [0 0 0]) > > NewPoints = > > -17.3789 -8.0447 -15.6597 -15.9802 -15.8312 > -44.7420 -36.1974 -32.5129 -44.7696 -45.0575 > -7.4955 -7.4959 -7.4962 -7.5578 -7.4765\
Success! Sorry, I just had a human error in one of my loops which must have been skewing one or more of my coordinates. I appreciate all of your help, you definitely saved me a lot of time. Also, if you don't mind me asking, how were you able to figure out which lines to use for the degree calculation - I might have to do something similar to this in the near future and I was wondering if you could point me towards something helpful, or if it was just a trivial calculation I glossed over?