91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 70KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-22
  • 語言: Matlab
  • 標簽: MATLAB??ply??

資源簡介

主要用于MATLAB讀取ply格式的三維模型,共有三個m文件,plyread.m,plywrite.m,plywritetri.m.

資源截圖

代碼片段和文件信息

function?[Elementsvarargout]?=?plyread(PathStr)
%PLYREAD???Read?a?PLY?3D?data?file.
%???[DATACOMMENTS]?=?PLYREAD(FILENAME)?reads?a?version?1.0?PLY?file
%???FILENAME?and?returns?a?structure?DATA.??The?fields?in?this?structure
%???are?defined?by?the?PLY?header;?each?element?type?is?a?field?and?each
%???element?property?is?a?subfield.??If?the?file?contains?any?comments
%???they?are?returned?in?a?cell?string?array?COMMENTS.
%
%???[TRIPTS]?=?PLYREAD(FILENAME‘tri‘)?or
%???[TRIPTSDATACOMMENTS]?=?PLYREAD(FILENAME‘tri‘)?converts?vertex
%???and?face?data?into?triangular?connectivity?and?vertex?arrays.??The
%???mesh?can?then?be?displayed?using?the?TRISURF?command.
%
%???Note:?This?function?is?slow?for?large?mesh?files?(+50K?faces)
%???especially?when?reading?data?with?list?type?properties.
%
%???Example:
%???[TriPts]?=?PLYREAD(‘cow.ply‘‘tri‘);
%???trisurf(TriPts(:1)Pts(:2)Pts(:3));?
%???colormap(gray);?axis?equal;
%
%???See?also:?PLYWRITE

%?Pascal?Getreuer?2004

[fidMsg]?=?fopen(Path‘rt‘); %?open?file?in?read?text?mode

if?fid?==?-1?error(Msg);?end

Buf?=?fscanf(fid‘%s‘1);
if?~strcmp(Buf‘ply‘)
???fclose(fid);
???error(‘Not?a?PLY?file.‘);?
end


%%%?read?header?%%%

Position?=?ftell(fid);
Format?=?‘‘;
NumComments?=?0;
Comments?=?{}; %?for?storing?any?file?comments
NumElements?=?0;
NumProperties?=?0;
Elements?=?[]; %?structure?for?holding?the?element?data
ElementCount?=?[]; %?number?of?each?type?of?element?in?file
PropertyTypes?=?[]; %?corresponding?structure?recording?property?types
ElementNames?=?{}; %?list?of?element?names?in?the?order?they?are?stored?in?the?file
PropertyNames?=?[]; %?structure?of?lists?of?property?names

while?1
???Buf?=?fgetl(fid);??? %?read?one?line?from?file
???BufRem?=?Buf;
???Token?=?{};
???Count?=?0;
???
???while?~isempty(BufRem) %?split?line?into?tokens
??????[tmpBufRem]?=?strtok(BufRem);
??????
??????if?~isempty(tmp)
?????????Count?=?Count?+?1; %?count?tokens
?????????Token{Count}?=?tmp;
??????end
???end
???
???if?Count? %?parse?line
??????switch?lower(Token{1})
??????case?‘format‘ %?read?data?format
?????????if?Count?>=?2
????????????Format?=?lower(Token{2});
????????????
????????????if?Count?==?3?&?~strcmp(Token{3}‘1.0‘)
???????????????fclose(fid);
???????????????error(‘Only?PLY?format?version?1.0?supported.‘);
????????????end
?????????end
??????case?‘comment‘ %?read?file?comment
?????????NumComments?=?NumComments?+?1;
?????????Comments{NumComments}?=?‘‘;
?????????for?i?=?2:Count
????????????Comments{NumComments}?=?[Comments{NumComments}Token{i}‘?‘];
?????????end
??????case?‘element‘ %?element?name
?????????if?Count?>=?3
????????????if?isfield(ElementsToken{2})
???????????????fclose(fid);
???????????????error([‘Duplicate?element?name?‘‘‘Token{2}‘‘‘.‘]);
????????????end
????????????
????????????NumElements?=?NumElements?+?1;
????????????NumProperties?=?0;
??? ??????Elements

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????734??2004-07-18?21:41??README.TXT
?????文件???????75683??2004-07-12?02:52??cow.ply
?????文件????????1336??2009-05-28?18:56??license.txt
?????文件???????13212??2004-07-12?03:34??ply.htm
?????文件???????15640??2004-07-18?21:37??plyread.m
?????文件????????8845??2004-07-12?03:41??plywrite.m
?????文件????????1098??2004-07-18?21:37??plywritetri.m

評論

共有 條評論