slerparray

版本 1.1.0 (1.8 KB) 作者: Andres Morales
This function gives SLERP the functionality of a look-up table (similar to interpolation at query points).
8.0 次下载
更新时间 2023/4/18

查看许可证

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

引用格式

Andres Morales (2024). slerparray (https://www.mathworks.com/matlabcentral/fileexchange/127813-slerparray), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2023a
与 R2019b 及更高版本兼容
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.1.0

Updated function name. The output is an array so "slerparray" is more accurate than "slerptable".

1.0.0