Home > Back-end >  STL stratified slice
STL stratified slice

Time:03-12

In a recent study of STL layered slices, have some problems, the code below
The function of triangles=read_binary_stl_file (filename)
% this function reads the binary STL file and gives out triangles as the output
% to be processed by slice_stl_create_path function.
F=fopen (' qiu. STL ', 'r');
Rd=fread (f, inf, 'uint8');
numTriangles=typecast (rd (81-84), "uint32"); The number of triangles in %, initial 80 bytes for header files, then 4 bytes I number of triangles in
Triangles=zeros (numTriangles, 12);
Sh=reshape (rd (85: the end), 50, numTriangles); % triangles in each account for 50 bytes,
Tt=reshape (typecast (reshape (sh (1:48, 1: numTriangles), 1 * numTriangles) 13, 'single'), 12, numTriangles) ';

Triangles (:, 1:9)=tt (:, 4:12);
Triangles (: 10:12)=tt (:, 1:3);
End

Triangles=zeros (numTriangles, 12); This is what mean? Red place all don't know what meaning, and to solve

CodePudding user response:

Baidu search relevant keywords,

Code function at the end of the day is not others to help you see or interpretation or comment; But by myself calm down and take a long enough time and energy to do it yourself step or set a breakpoint or step to perform to a certain intermediate result shows or written to the log file analysis step by step,
Remind: cow x teacher cannot replace the student understand and use the toilet!
Single step debugging and set breakpoint debugging (VS IDE compilation connection through later, press F10 or F11 key step, press Shift + F11 exit the current function; In a press F9 set breakpoints after press F5 execution stops at the breakpoint,) is one of the programmers must master the skills,

CodePudding user response:

The Matlab language, initialize an array,
The rest of the red is the STL format specification oh,
Is essentially the Matlab language to read a binary file, and the data type conversion,

CodePudding user response:

Hello, I am new to the STL file layered algorithm in MATLAB, recently at a layered function, do you have a source?
  • Related