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
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 % E-mail: N/A 0016 % Created: 2021-01-31 0017 % Copyright 2021-2024 0018 0019 % Extract only the rotation 0020 ROT = [ROT(1:3,1:3), [0 0 0]'; [0 0 0 1]]; 0021 0022 TFM = createTranslation3d(point) * ROT * createTranslation3d(-point); 0023 0024 end 0025 0026