From 188d1b9f2916dbb6a9ba391d48678ed529dcccaa Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 21 Nov 2026 05:11:23 +0000 Subject: [PATCH] updateQuiver: compute arrowheads without the Image Processing Toolbox --- .../handlegraphics/updateQuiver.m | 76 ++++++------------- 1 file changed, 23 insertions(+), 53 deletions(-) diff --git a/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m b/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m index 0a4dda76..9c121a14 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateQuiver.m @@ -235,26 +235,15 @@ end function outPoint = translation2D(inPoint, offsetPoint) - xt = offsetPoint(1); yt = offsetPoint(2); - T = affine2d(... - [... - 1 , 0 , 0; ... - 0 , 1 , 0; ... - xt, yt, 1 ... - ]... - ); - outPoint = transformPointsForward(T, inPoint); + outPoint = inPoint + offsetPoint(:)'; end function outPoint = rotation2D(inPoint, phi) - T = affine2d(... - [... - cos(phi) , sin(phi), 0; ... - -sin(phi), cos(phi), 0; ... - 0 , 0 , 1; ... - ]... - ); - outPoint = transformPointsForward(T, inPoint); + R = [... + cos(phi) , sin(phi); ... + -sin(phi), cos(phi) ... + ]; + outPoint = inPoint * R; end function quiverBarb = getQuiverBarb3D(... @@ -304,52 +293,33 @@ end function outPoint = translation3D(inPoint, offsetPoint) - xt = offsetPoint(1); yt = offsetPoint(2); zt = offsetPoint(3); - T = affine3d(... - [... - 1 , 0 , 0 , 0; ... - 0 , 1 , 0 , 0; ... - 0 , 0 , 1 , 0; ... - xt, yt, zt, 1 ... - ]... - ); - outPoint = transformPointsForward(T, inPoint); + outPoint = inPoint + offsetPoint(:)'; end function outPoint = rotation3D(inPoint, phi, refAxis) switch refAxis case 'x' - T = affine3d(... - [... - 1, 0 , 0 , 0; ... - 0, cos(phi) , sin(phi) , 0; ... - 0, -sin(phi), cos(phi) , 0; ... - 0, 0 , 0 , 1 ... - - ]... - ); + R = [... + 1, 0 , 0 ; ... + 0, cos(phi) , sin(phi) ; ... + 0, -sin(phi), cos(phi) ... + ]; case 'y' - T = affine3d(... - [... - cos(phi), 0, -sin(phi), 0; ... - 0 , 1, 0 , 0; ... - sin(phi), 0, cos(phi) , 0; ... - 0 , 0, 0 , 1 ... - ]... - ); + R = [... + cos(phi), 0, -sin(phi); ... + 0 , 1, 0 ; ... + sin(phi), 0, cos(phi) ... + ]; case 'z' - T = affine3d(... - [... - cos(phi) , sin(phi), 0, 0; ... - -sin(phi), cos(phi), 0, 0; ... - 0 , 0 , 1, 0; ... - 0 , 0 , 0, 1 ... - ]... - ); + R = [... + cos(phi) , sin(phi), 0; ... + -sin(phi), cos(phi), 0; ... + 0 , 0 , 1 ... + ]; end - outPoint = transformPointsForward(T, inPoint); + outPoint = inPoint * R; end function scaleFactor = getScaleFactor(xData, uData, nSteps)