三维空间旋转计算,见参考1,这里附截图一张,文中所用为右手坐标系,可根据实际情况自行转换:
当绕平行于某一坐标轴的旋转变换时,基本步骤如下:
(1) 平移物体使旋转轴与所平行的坐标轴重合;
(2) 沿着该坐标轴进行指定角度的旋转;
(3) 平移物体使旋转轴移回到原位置。
Matlab实例:txt文件中为1280*28个散点,分别为28个不同角度拍摄,现展示三维效果:
clc;clear;close all
load xxx.txt
A=xxx;
A(A==-1000)=NaN;
load AngelR.txt
B_angel=AngelR;
for i=1:28
t=-640:1:1280-641;
%t=1:1280;
x=t*cos(B_angel(i));
y=t*sin(B_angel(i));
z=A((1280*i-1279):1280*i)*0.013;
plot3(x,y,z)
hold on
end
axis([-700,700,-700,700,3,8])
grid
自己用标准圆做了下仿真:
clc;clear;close all;
Angle=0:3:90;
alpha=0:pi/20:pi; %角度[0,pi]
R=2; %半径
for i=[1:1:21]
t=R*cos(alpha)-0.2; %-0是为无偏转,偏差越大表示偏离0中心越大
x=t*cos(Angle(i));
y=t*sin(Angle(i));
z=R*sin(alpha);
plot3(x,y,z,'-')
text(x(5),y(5),z(5),num2str(i))
hold on
%view(90,0)
end
axis equal
grid
参考:
http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
http://www.cnblogs.com/graphics/archive/2012/08/10/2627458.html
https://zhidao.baidu.com/question/311298186.html (指定角度)
http://www.ilovematlab.cn/thread-249144-1-1.html
http://blog.csdn.net/changbaolong/article/details/8307052