如果想用字母表示角度,有两个方法:
1. 用三角函数sind(θ4)、cosd(θ4)、tand(θ4)、atand(θ4)进行表示,注意:θ4在输入时是角度,只是没有度数特有的符号(°)而已。
2. 用deg2rad将角度转换为弧度。45度就是45/180*pi,60度就是60/180*pi。pi=3.1415。
clearm = csvread('zero_1.csv', 2, 0);n = csvread('one_1.csv', 2, 0);for i=1:1:3 m1(:,i)=m(:,i); n1(:,i)=n(:,i);endk=36/180*pi;k1=1/180*pi;trans=[cos(k) sin(k) 0;-sin(k) cos(k) 0;0 0 1];trans1=[01 0 0;0 cos(k1) sin(k1);0 -sin(k1) cos(k1)];trans2=[cos(-k) sin(-k) 0;-sin(-k) cos(-k) 0;0 0 1];tmp=(trans2*trans1*trans*n1')';tmp=[tmp;m1];scatter3(tmp(:,1),tmp(:,2),tmp(:,3),1)%scatter3(m(:,1),m(:,2),m(:,3),1)%scatter3(n(:,1),n(:,2),n(:,3),1)
2019-03-23八向数据合成
cleara{10} = csvread('0 0.csv', 2, 0);a{1} = csvread('-1 0.csv', 2, 0);a{2} = csvread('1 0.csv', 2, 0);a{3} = csvread('0 -1.csv', 2, 0);a{4} = csvread('0 1.csv', 2, 0);a{5} = csvread('-0.7 0.7.csv', 2, 0);a{6} = csvread('0.7 -0.7.csv', 2, 0);a{7} = csvread('-0.7 -0.7.csv', 2, 0);a{8} = csvread('0.7 0.7.csv', 2, 0);for i=1:1:3 b{1}(:,i)=a{1}(:,i); b{2}(:,i)=a{2}(:,i); b{3}(:,i)=a{3}(:,i); b{4}(:,i)=a{4}(:,i); b{5}(:,i)=a{5}(:,i); b{6}(:,i)=a{6}(:,i); b{7}(:,i)=a{7}(:,i); b{8}(:,i)=a{8}(:,i); b{10}(:,i)=a{10}(:,i);endans=[trans(b{1},-1,0,0);trans(b{2},1,0,0);trans(b{3},0,1,0);trans(b{4},0,-1,0);trans(b{8},0.7,0.7,0);b{10};];% trans(b{6},-0.7,0.7,0);% trans(b{1},-1,0,0);trans(b{2},1,0,0);trans(b{3},0,1,0);trans(b{4},0,-1,0);scatter3(ans(:,1),ans(:,2),ans(:,3),1)
function x=trans(m,x,y,z)k=36/180*pi;trans1=[cos(k) sin(k) 0;-sin(k) cos(k) 0;0 0 1];trans2=[cos(-k) sin(-k) 0;-sin(-k) cos(-k) 0;0 0 1];x=x/180*pi;y=y/180*pi;z=z/180*pi;transy=[cos(y) 0 -sin(y);0 1 0;sin(y) 0 cos(y)];transz=[cos(z) sin(z) 0;-sin(z) cos(z) 0;0 0 1];transx=[1 0 0;0 cos(x) sin(x);0 -sin(x) cos(x)];x=(trans2*transy*transx*transz*trans1*m')';% x=(transy*transx*transz*m')';
2019-03-23 着色演示与csv写入
cleara{10} = csvread('0 0.csv', 2, 0);a{1} = csvread('-1 0.csv', 2, 0);a{2} = csvread('1 0.csv', 2, 0);a{3} = csvread('0 -1.csv', 2, 0);a{4} = csvread('0 1.csv', 2, 0);a{5} = csvread('-0.7 0.7.csv', 2, 0);a{6} = csvread('0.7 -0.7.csv', 2, 0);a{7} = csvread('-0.7 -0.7.csv', 2, 0);a{8} = csvread('0.7 0.7.csv', 2, 0);for i=1:1:3 b{1}(:,i)=a{1}(:,i); b{2}(:,i)=a{2}(:,i); b{3}(:,i)=a{3}(:,i); b{4}(:,i)=a{4}(:,i); b{5}(:,i)=a{5}(:,i); b{6}(:,i)=a{6}(:,i); b{7}(:,i)=a{7}(:,i); b{8}(:,i)=a{8}(:,i); b{10}(:,i)=a{10}(:,i);endb{1}=trans(b{1},-1,0,0);b{2}=trans(b{2},1,0,0);b{3}=trans(b{3},0,1,0);b{4}=trans(b{4},0,-1,0);b{8}=trans(b{8},0.7,0.7,0);for i=1:1:3 a{1}(:,i)=b{1}(:,i); a{2}(:,i)=b{2}(:,i); a{3}(:,i)=b{3}(:,i); a{4}(:,i)=b{4}(:,i); a{5}(:,i)=b{5}(:,i); a{6}(:,i)=b{6}(:,i); a{7}(:,i)=b{7}(:,i); a{8}(:,i)=b{8}(:,i);endans0=[a{1};a{2};a{3};a{4};a{8};a{10};];% csvwrite('tst.csv',ans0);scatter3(ans0(:,1),ans0(:,2),ans0(:,3),1,ans0(:,4),'.');%x,y,z,粗细,强度,形状(默认是圈)caxis([0,100]);%强度的取值范围colorbar; %在右侧显示颜色条
2019-03-24 支架构建
Geomagic处理几百万级数量点云一般处理步骤:
这只是一般的步骤, 对于处理结果要求不高的操作过程;高手请自行略过;
也许Geomagic的版本不同,但操作一般都是一样的顺序;
操作步骤为Geomagic中工具栏的按钮点击顺序:
导入点云,删除外部点,着色点,非连接项-删除,全局注册,联合点对象,体外孤点-删除,( 较保守的算法,一般使用三次 )提取孔等特征,减噪音,统一采样,封装