MENTION]درود
بسیار متشکر از توضیحات کاربردی شما،
با توضیح شما بنده کد اولیه را اصلاح کردم. جواب داد اما مشکل اینجاست که قسمت اول کد یعنی مختصات vertex ها را جواب میدهد اما برای نرمال فکتور ها نه ولی وقتی قسمت نرمال فکتورها را جداگانه در کد دیگری میریزیم جواب میدهد.
در واقع منظور من این است که هر دو در یک کد جواب بدهد.
بازم ممنونم
کد اصلاح شده:
function [Vertices,normal_Vector]= bbbb
fid = fopen('Part1.txt');
c = textscan(fid,...
'%*s %*s vertex %f %f %f vertex %f %f %f vertex %f %f %f %*s %*s',...
'delimiter', '\n','endofline','\r\n',...
'collectoutput', true);
a=c{1,1};
Vertices=zeros(3*length(a),3);
k=1;
for i=1:1:length(a)
Vertices(k,:)=a(i,1:3);
Vertices(k+1,:)=a(i,4:6);
Vertices(k+2,:)=a(i,7:9);
k=k+3;
end
fclose(fid);
fod = fopen('Part1.txt');
d = textscan(fod,...
'facet normal %f %f %f %*s %*s %*s %*s %*s %*s',...
'delimiter', '\n','endOfLine','\r\n',...
'CollectOutPut',true);
normal_Vector=d{1,1};
fclose(fod);
end
کد نرمال فکتور جداگانه:
function [normal_Vector]=Untitled3
fod = fopen('Part1.txt');
d = textscan(fod,...
'facet normal %f %f %f %*s %*s %*s %*s %*s %*s',...
'delimiter', '\n','endOfLine','\r\n',...
'CollectOutPut',true);
normal_Vector=d{1,1};
fclose(fod);