rotate a plane onto another plane

15 views (last 30 days)
David
David on 17 Feb 2012
Commented: Varoujan on 25 Aug 2016
I have a cross section (consisting of nx3 points) that I would like to rotate onto another plane so that it lies parallel to 2 orthogonal vectors. The cross-section is centered at the origin and lies on the y-z plane (x is 0). The big picture is that I want to construct a series of cross sections normal to a curve at several locations along its length. I have the vectors at each point on the curve, now I just need to rotate my cross sections.
I have made several attempts using [4x4] rotation matrices and while I have been able to rotate the cross-section in the direction of 1 of the vectors I've been unable to make my cross section parallel to the 2 orthogonal vectors. I'm now not sure if this is even the right approach to make 1 plane parallel to another. Coupled with the difficulty of visualizing the 3d rotations I've hit a wall.
I have included some of my sample data below and would really appreciate some help and direction on this. Thank you!
David
points=[0 0 3; 0 1 2.6; 0 1.3 2.3; 0 2.2 1.8; 0 2.5 0.8; 0 2.8 0; 0 2.2 -0.8; 0 1.9 -1.1; 0 1.3 -1.8; 0 1 -2.5; 0 0 -3; 0 -0.5 -2.7; 0 -1.1 -2.3; 0 -1.8 -1.8; 0 -2.1 -1; 0 -2.5 0; 0 -2.2 0.5; 0 -1.8 1.8; 0 -1.5 2.3; 0 -0.8 2.8;0 0 3]; % points defining the x-section
%orthogonal vectors
vec1=[-0.8994 -0.1332 0.4160];
vec2=[0.0254 -0.9668 -0.2540];
  1 Comment
Varoujan
Varoujan on 25 Aug 2016
I have a similar problem - I am hoping that you guys can recommend a version of the answer to my problem.
Basically, I have a high density x,y,z surface (basically a z-map, i.e., the data is the z height of a surface). For the sake of argument, let's assume x,y range from -100 to 100, in 1 mm steps. At each x,y location, I have a z value. The general shape is something like a potato chip or saddle, i.e., NOT a plane but also NOT random.
This surface moves rigidly over time. Rather than measuring the map every time, we would like to measure a coarse grid, say a 3x3 grid at +/-50 and 0. What we want is to adjust the z values of the high density map such that the full map coincides with the quick map.
I know how I can fit a simple plane to the surface. So, what I did thus far is to fit a plane to the 3x3 map (basically simple left divide or Affine operation). Then, I evaluated the full x,y,z map at the same grid points as the 3x3 map using griddata. What I now get are two sets of coefficients, C1 and C2 of the form: zx = C1(1) * xx + C1(2) * yy + C1(3). I am stuck at this point. I don't know how to shift the full map by somehow using this information.

Sign in to comment.

Accepted Answer

Sven
Sven on 18 Feb 2012
David, let me introduce you to geom3d. I'm a fan of, user of, and occasional contributor to it.
With it you can do something like the following:
points=[0 0 3; 0 1 2.6; 0 1.3 2.3; 0 2.2 1 .8; 0 2.5 0.8; 0 2.8 0; 0 2.2 -0.8; 0 1.9 -1.1; 0 1.3 -1.8; 0 1 -2.5; 0 0 -3; 0 -0.5 -2.7; 0 -1.1 -2.3; 0 -1.8 -1.8; 0 -2.1 -1; 0 -2.5 0; 0 -2.2 0.5; 0 -1.8 1.8; 0 -1.5 2.3; 0 -0.8 2.8;0 0 3];
vec1=[-0.8994 -0.1332 0.4160];
vec2=[0.0254 -0.9668 -0.2540];
myPlane = [0 0 0 vec1 vec2];
TF = createBasisTransform(myPlane,'global')
newPoints = transformPoint3d(points, TF)
I have a feeling that the above isn't quite what you're looking to do (i'm not sure if you're trying to transform points from or to a global plane...), but I think it will help. By any chance are you trying to make a curved planar reformation?
  2 Comments
David
David on 20 Feb 2012
Thanks for your answer Sven. It certainly does help. My cross-section is now aligned with the orthogonal vectors. Do you know what is the theory behind the formation of the transformation matrix here? I haven't seen it put together like that before. If I have understood the code and you correctly I believe I am transforming from a global plane.
I'm not familiar with the term curved planar reformation, but my application is the creation of a 3d volume from a series of 2d images, which are orientated normal to a curved line.
Sven
Sven on 22 Feb 2012
David, the theory behind the transformation matrix is just regular old linear algebra. Any coordinate is expressed in terms of a coordinate system. That same coordinate can equally be expressed in terms of some other coordinate system. The geom3d package just does a good job of packaging those transformations into easily programmed pieces.
As far as your application goes, I've found the best way to work with such problems is to always be crystal clear about *which* coordinate system any points you have are expressed in. For example, you've got a set of 3D points defining your 3D curve (let's call it the backbone). Those 3D points are expressed in the global system. I would imagine however, that each of your contours are taken from a coordinate system perpendicular to that backbone, at some point along that backbone. I would expect then, that whenever one of these coordinates is expressed in its *local* coordinate system, the Z-value will always be zero.
This is where I was a little confused with your example - your contour actually has non-zero Z values, so it seems that it's expressed in a *global* csys. Knowing which system your points are actually in and which system you want to interpret them in determines the parameters you give to the createBasisTransform() function above.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!