slerparray
Versión 1.1.0 (1,76 KB) por
Andres Morales
This function gives SLERP the functionality of a look-up table (similar to interpolation at query points).
This function is a combination of SLERP interpolation, with a lookup table. It interpolates the quaternions of the underlying function QUATS = F(X) at the query points XQ.
Quaternions maybe be entered as a quaternion array or a Nx4 double matrix. X and XQ must be Nx1 matrices.
MATLAB SLERP function requires knowledge of the quaternions before/after the interpolation point as well as the interpolation coefficient. These might not be evident if each quaternions are mapped to an X value.
The function uses linear interpolation to calculate the interpolation coefficient.
Example Code:
time = [10;30;50];
q1 = quaternion([-30,0,-10],'eulerd','ZYX','frame');
q2 = quaternion([-40,-30,35],'eulerd','ZYX','frame');
q3 = quaternion([-80,10,30],'eulerd','ZYX','frame');
quatsIN = [q1;q2;q3];
timeq = (11:49)';
quatsOUT = slerparray(time,quatsIN,timeq);
pts = rotatepoint(quatsIN,[1,0,0]);
newpts = rotatepoint(quatsOUT,[1,0,0]);
figure
[X,Y,Z] = sphere;
surf(X,Y,Z,'FaceColor',[0.57 0.57 0.57])
hold on;
scatter3(newpts(:,1),newpts(:,2),newpts(:,3),'filled','b')
scatter3(pts(:,1),pts(:,2),pts(:,3),'filled','r')
view(30,10)
axis equal
Citar como
Andres Morales (2025). slerparray (https://www.mathworks.com/matlabcentral/fileexchange/127813-slerparray), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2023a
Compatible con cualquier versión desde R2019b
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.