Giter Club home page Giter Club logo

microstl's Introduction

microstl

CI License: MIT

A small C++ library for reading and writing STL mesh files.

Features

  • Supports ASCII and binary STL files
  • Header-only library, no compilation required
  • Single file, easy to add to your project
  • Does not depend on any third-party libraries
  • Works well with your existing mesh data structures
  • Optional vertex deduplication after reading (to get a proper face-vertex data structure)
  • CMake for tests and examples
  • Tested with Visual Studio, GCC and Clang
  • Automated builds, tests and code coverage analysis using GitHub Actions

Quickstart: Reading a STL file

  1. Download the header file microstl.h
  2. Put the file into your include directory
  3. Include the file: #include <microstl.h>
  4. Create a handler that receives the data and creates a mesh: microstl::MeshReaderHandler meshHandler;
  5. Call the reader with the STL file path and the handler: microstl::Reader::readStlFile("path/to/my.stl", meshHandler);
  6. Check return value of the reader for microstl::Result::Success and handle any errors
  7. Access the triangle data in the mesh handler at meshHandler.mesh.facets

You can find the complete example code here. Check out the examples folder for more examples. The file custom_handler.cpp shows how to write your own handler. Such a custom handler can be used to fill your existing mesh data structues.

The writer follows the same principle. You can use the included simple mesh data structures or you can implement a custom data provider to connect your own data structures.

Limitations

  • Requires at least a C++ 17 compiler
  • Binary reader and writer works only on little-endian systems

microstl's People

Contributors

ahoarau avatar cry-inc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zxw2600 ahoarau

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.