关键词不能为空

当前您在: 主页 > 英语 >

stl文档读取MATLAB代码

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-01 21:55
tags:

-

2021年2月1日发(作者:refresh是什么意思)


%Copyright 2018 John Moosemiller





%Permission is hereby granted, free of charge, to any person obtaining a


copy


of


this


software


and


associated


documentation


files


(the



to deal in the Software without restriction, including without limitation


the rights to use, copy, modify, merge, publish, distribute, sublicense,


and/or


sell


copies


of


the


Software,


and


to


permit


persons


to


whom


the


Software


is furnished to do so, subject to the following conditions:





%The above copyright notice and this permission notice shall be included


in all copies or substantial portions of the Software.





%THE SOFTWARE IS PROVIDED


OR


IMPLIED,


INCLUDING


BUT


NOT


LIMITED


TO


THE


WARRANTIES


OF


MERCHANTABILITY,


FITNESS


FOR


A


PARTICULAR


PURPOSE


AND


NONINFRINGEMENT.


IN


NO


EVENT


SHALL


THE


AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER


LIABILITY,


WHETHER


IN


AN


ACTION


OF


CONTRACT,


TORT


OR


OTHERWISE,


ARISING


FROM,


OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN


THE SOFTWARE.





function


[vertices, faces, color] = stlread(filename)



% This function reads an STL file in binary format into matrixes vertices



% and faces which can be used by patch to view the stl.



%



% MATLAB code by Doron Harlev



% Octave edits by John Moosemiller && @zmughal





read_norm = 0;


% whether we want to read the face normals





% Process arguments {{{



if


nargout > 3



error(


'Too many output arguments'


);



end



use_color = ( nargout == 3 );


% }}}





% Open the file, assumes STL Binary format. {{{



fid=fopen(filename,


'r'


);



if


( fid == -1)



error(


'File could not be opened, check name or path.'


)



end


% }}}





% Read in header {{{



ftitle = fread(fid, 80,


'uchar=>schar'


);


% Read file title



num_facet = fread(fid, 1,


'int32'


);


% Read number of Facets





fprintf(


'nTitle: %sn'


, char(ftitle'));



fprintf(


'Num Facets: %dn'


, num_facet);



% }}}





% Preallocate memory to save running time {{{



vertices = zeros( 3 * num_facet, 3 );



faces = zeros( num_facet, 3 );



if


use_color



color = uint8( zeros( 3, num_facet ) );



end


-


-


-


-


-


-


-


-



本文更新与2021-02-01 21:55,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/595378.html

stl文档读取MATLAB代码的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文