Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 23 additions & 53 deletions plotly/plotlyfig_aux/handlegraphics/updateQuiver.m
Original file line number Diff line number Diff line change
Expand Up @@ -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(...
Expand Down Expand Up @@ -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)
Expand Down
Loading