Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 2.42 KB

challenge.md

File metadata and controls

68 lines (51 loc) · 2.42 KB

STL File Analysis

STL Files

An STL (stereolithography) file is a standard file format for defining 3D models that will be printed. STL files describe only the surface geometry of a three-dimensional object without any representation of color, texture or other common CAD model attributes. STL files have both an ASCII and binary representation but for this challenge we'll only work with the ASCII version.

Format

solid name
  facet normal ni nj nk
      outer loop
          vertex v1x v1y v1z
          vertex v2x v2y v2z
          vertex v3x v3y v3z
      endloop
  endfacet
endsolid name

For example here is a very simple 2 triangle STL.

solid simple
  facet normal 0 0 0
      outer loop
          vertex 0 0 0
          vertex 1 0 0
          vertex 1 1 1
      endloop
  endfacet
  facet normal 0 0 0
      outer loop
          vertex 0 0 0
          vertex 0 1 1
          vertex 1 1 1
      endloop
  endfacet
endsolid simple

Challenge

For this challenge we'd like you to implement an STL parser that can do some basic analysis of a model. It should be able to report these metrics

  • The number of triangles in the model
  • The surface area of the model
  • The bounding box of the model (the 8 points defining a cube (or 3D rectangle) with smallest volume that completely contains the shape)

Assumptions

In order to reduce the complexity of the challenge you can safely assume that the input STL files are all properly formed and all of the triangles are non overlapping.

Example output

Number of Triangles: 2
Surface Area: 1.4142
Bounding Box: {x: 0, y: 0, z: 0 }, {x: 1, y: 1, z: 1 } ...

Instructions

You may develop your solution in any language that you like. However along with your solution please provide a README that includes instructions for running your code, an explanation of the design decisions you made, and potential performance improvements you might make so your solution could handle a model with millions of triangles. You should also include reasonable automated tests as if this were production code.

What We're Looking For

While this challenge is about working with 3D models we're not trying to test your math knowledge or ability to think about 3D space. We're most interested in seeing how understandable and extensible your code is. If you're struggling figuring how to calculate any of the statistics please just explain where you would put the calculations in your code.