Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Reposition 3D plane slice
Replies: 16   Last Post: Jun 15, 2012 5:22 PM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Myles Posts: 11 Registered: 6/14/12
Reposition 3D plane slice
Posted: Jun 15, 2012 5:07 PM
 Plain Text Reply

"Matt J" wrote in message <jrg0i3\$m5j\$1@newscl01ah.mathworks.com>...
> "Myles" wrote in message <jrfph5\$jej\$1@newscl01ah.mathworks.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?

Either way! Thanks so much!

Date Subject Author
6/14/12 Myles
6/14/12 Matt J
6/14/12 Matt J
6/14/12 Myles
6/14/12 Matt J
6/14/12 Myles
6/14/12 Matt J
6/14/12 Myles
6/14/12 Matt J
6/14/12 Myles
6/15/12 Matt J
6/15/12 Matt J
6/15/12 Myles
6/15/12 Matt J
6/15/12 Myles
6/15/12 Matt J
6/14/12 Myles

© The Math Forum at NCTM 1994-2018. All Rights Reserved.