views:

11

answers:

1

Hi all,

I read the short description of the STLA Files (ASCII stereolithography files) but , Im sorry, I don't get how the facets/triangles are defined.

For Example in the example for the cube:

solid cube_corner
  facet normal 0.0 -1.0 0.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 1.0 0.0 0.0
      vertex 0.0 0.0 1.0
    endloop
  endfacet
  facet normal 0.0 0.0 -1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal 0.0 0.0 -1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 0.0 1.0
      vertex 0.0 1.0 0.0
    endloop
  endfacet
  facet normal 0.577 0.577 0.577
    outer loop
      vertex 1.0 0.0 0.0
      vertex 0.0 1.0 0.0
      vertex 0.0 0.0 1.0
    endloop
  endfacet
endsolid

The first 'facet' describes a 3D triangle isn't it ? (0,0,0),(1,0,0),(0,0,1). Then what is the use the normal vector (0,-1,0) ? In this example, what would be the 3D coordinates of the 8 vertexes for this cube ?

Thanks

A: 

The normal defines which way the face points.

You can calculate it from the three points that make up the facet. Choose one as the origin and then take the cross product of OA and OB (where A and B are the other two vertices). However the normal you get will depend on which vertex you pick as the origin and the order you do the cross product. If you have the normal defined you can determine the correct "winding order" of the vertices.

The 8 vertices of the cube will be the 8 unique vertices across all the facets.

However, this solid doesn't represent a cube as there are only 4 triangles, two of the normals are the same and one isn't at right angles to the others.

ChrisF