Wrong result from createBasisTransform
I noticed some weird behaviour in createBasisTransform (see code below). When calculating the transform from a plane with a Z-normal to an Y-normal, I get the wrong affine transform. Is this normal behaviour? I'm using Matlab R2017b.
p1 = createPlane([0 0 0],[0 0 1]);
% create points in XY plane
pnts1 = [-1 -1 0;
1 -1 0;
1 1 0;
-1 1 0];
drawPoint3d(pnts1);
drawPlane3d(p1);
% --> points are all in the XY plane
% create YZ plane (X-normal)
p2 = createPlane([0 0 0],[1 0 0]);
% transform points
t2 = createBasisTransform3d(p1,p2);
pnts2 = transformPoint3d(pnts1,t2);
% --> points are all in the YZ plane
hold on
drawPoint3d(pnts2);
drawPlane3d(p2);
hold off
% create XZ plane (Y-normal)
p3 = createPlane([0 0 0],[0 1 0]);
% transform points
t3 = createBasisTransform3d(p1,p3);
pnts3 = transformPoint3d(pnts1,t3);
% --> for some reason points are still in the YZ plane
hold on
drawPoint3d(pnts3);
drawPlane3d(p3);
hold off
Hi,
I was away from computer for a while. I will check it ASAP. Best David
Hi again,
after having a look, I believe this is the normal behaviour. After applying transform "t3", the coordinates of the points "pnts3" are expressed in terms of direction vectors of the plane p3. The four points are in the (global) XY plane. The plane p3 has first direction vector as [0 0 -1]. Therefore, the four points have their first coordinate in the basis of plane p3 equal to a constant (here equal to zero). Then, they all lie in a plane that corresponds to a YZ plane.
You can use the following to project back to "reference" basis:
t3g = createBasisTransform3d(p3, 'global');
pnts3g = transformPoint3d(pnts3, t3g);
drawPoint3d(pnts3g, 'g*');
Best, David