MATLAB Answers

0

Question about STL file

Asked by raouf takab on 25 Jul 2019
Latest activity Commented on by raouf takab on 26 Jul 2019
Hello
I have a vector file as xyz How can I calculate normal vector? How can I create a stl file?.
what is the facet in stl file?
Thanks.

  0 Comments

Sign in to comment.

2 Answers

Rik
Answer by Rik
on 25 Jul 2019
Edited by Rik
on 25 Jul 2019
 Accepted Answer

An stl file has two parts. One part contains triplets of vertex IDs, and the other part contains the xyz coordinates of each vertex. The triplets tell you the three corners of a face of your mesh.
In principle there can be more than three IDs, but triangular meshes are the most usual.
The data you have seems to only be the faces array, although maybe the vertices array is hidden in the last part of your array.
Also, the faces array describes the vertices, not the normal vector of that face.

  3 Comments

raouf takab on 25 Jul 2019
Thank you for you reply.
In fact, my data is the coordinates of each vertex, and I wanted to understand the face to make the file?
Rik
on 26 Jul 2019
The face variable describes how you need to connect the vertices to form your mesh, so without more information or assumptions it's impossible to tell what the face variable should be. You only have a point cloid, not a mesh.
Also, I'm puzzled why you accepted the other answer. It doesn't sound like it solved your problem
raouf takab on 26 Jul 2019
your right,
thank you Rik.

Sign in to comment.


Answer by jahanzaib ahmad on 25 Jul 2019

https://uk.mathworks.com/matlabcentral/fileexchange/20922-stlwrite-write-ascii-or-binary-stl-files?s_tid=srchtitle

  1 Comment

raouf takab on 25 Jul 2019
Thank you for you reply.
Has not explained the face, is the face the same as the normal vector?

Sign in to comment.