matlab批量读取obj文件
clear;
fileID = fopen(‘C:\Users\lixiaohu\Desktop\101028\101028_l\location__.obj’,‘r’);
formatSpec = ‘%f’;
A = fscanf(fileID,formatSpec);
B=reshape(A,4,4,16);
fileID = fopen(‘C:\Users\lixiaohu\Desktop\101028\101028_u\location__.obj’,‘r’);
formatSpec = ‘%f’;
uA = fscanf(fileID,formatSpec);
uB=reshape(uA,4,4,16);
figure;
for i=0:1:15
str= strcat (‘C:\Users\lixiaohu\Desktop\101028\101028_l\TOOTH_’, int2str(i) , ‘.obj’) ;
ustr= strcat (‘C:\Users\lixiaohu\Desktop\101028\101028_u\TOOTH_’, int2str(i) , ‘.obj’) ;
tt=obj(str);
ttp=[tt;ones(1,length(tt))];
ttt=B(:,:,i+1)’*ttp;
ttt(4,:)=[];
utt=obj(ustr);
uttp=[utt;ones(1,length(utt))];
uttt=uB(:,:,i+1)’*uttp;
uttt(4,:)=[];
plot3(ttt(1,:),ttt(2,:),ttt(3,:));hold on;
plot3(uttt(1,:),uttt(2,:),uttt(3,:));hold on;
end
ax1=zeros(3,3);
ax=obj(‘C:\Users\lixiaohu\Desktop\101028\101028_l\AXIS_.obj’)
ax1=ax(:,1:3)
ax1ax1’
N=obj(‘C:\Users\lixiaohu\Desktop\101028\101028_l\planeNormal__.obj’);
plot3(N(1,:),N(2,:),N(3,:));
plot3([1,2],[4,5],[7,8],’’)
1万+




被折叠的 条评论
为什么被折叠?



