CREATEROTATIONABOUTPOINT3D Rotate about a point using a rotation matrix. TFM = createRotationAboutPoint3d(ROT, POINT) Returns the transformation matrix corresponding to a translation(-POINT), rotation with ROT and translation(POINT). Ignores a possible translation in ROT(1:3,4). See also: transforms3d, transformPoint3d, createRotationOx, createRotationOy, createRotationOz, createRotation3dLineAngle, createRotationVector3d, createRotationVectorPoint3d --------- Author: oqilipo Created: 2021-01-31 Copyright 2021
0001 function TFM = createRotationAboutPoint3d(ROT, point) 0002 %CREATEROTATIONABOUTPOINT3D Rotate about a point using a rotation matrix. 0003 % 0004 % TFM = createRotationAboutPoint3d(ROT, POINT) Returns the transformation 0005 % matrix corresponding to a translation(-POINT), rotation with ROT and 0006 % translation(POINT). Ignores a possible translation in ROT(1:3,4). 0007 % 0008 % See also: 0009 % transforms3d, transformPoint3d, createRotationOx, createRotationOy, 0010 % createRotationOz, createRotation3dLineAngle, createRotationVector3d, 0011 % createRotationVectorPoint3d 0012 % 0013 % --------- 0014 % Author: oqilipo 0015 % Created: 2021-01-31 0016 % Copyright 2021 0017 0018 % Extract only the rotation 0019 ROT = [ROT(1:3,1:3), [0 0 0]'; [0 0 0 1]]; 0020 0021 TFM = createTranslation3d(point) * ROT * createTranslation3d(-point); 0022 0023 end 0024 0025