Skip to content
/ FileSTL Public
forked from TinyTinni/FileSTL

Parser for STL files (ASCII and binary)

License

Notifications You must be signed in to change notification settings

wowa/FileSTL

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

STL File Reader and Writer

Reads and writes STL files for 3D Geometry.

Install

Header only

Dependencies:

Small and Fast Reference

Use one of the read functions in namespace tyti::stl.

Possible scalar values for the template float, double, default is float.

//////////////////////////////////////////////////////////////
// Reader Functions:
template<typename T, typename IterT>
inline bool read(basic_solid<T>& out, IterT begin, IterT end)
template<typename T, typename IterT>
inline std::pair< basic_solid<T>, bool > read(IterT begin, IterT end)
template<typename IterT>
inline std::pair< solid, bool > read(IterT begin, IterT end)

//////////////////////////////////////////////////////////////
// Writer Functions: (streamT is an output stream type)
template<typename T, typename streamT>
void write(streamT& out, const basic_solid<T>& s, bool binary)
template<typename T, typename streamT>
void write_binary(streamT& out, const basic_solid<T>&s)
template<typename T, typename streamT>
void write_ascii(streamT& out, const basic_solid<T>&s)

//////////////////////////////////////////////////////////////
// Output DataType:
template<typename T>
struct basic_solid
{
    using vec3 = basic_vec3<T>;
    using scalar_type = T;
    std::string header; //solid name or header
    std::vector<vec3> normals;
    std::vector<vec3> vertices;
    std::vector<std::uint16_t> attributes; //only available in binary files
};

typedef basic_solid<float> solid;
typedef basic_solid<float> dsolid;

template<typename T>
struct basic_vec3
{
    using scalar_type = T;
    T data[3];
};

typedef basic_vec3<float> vec3;
typedef basic_vec3<float> dvec3;

License

MIT License © Matthias Möller. Made with ♥ in Germany.

About

Parser for STL files (ASCII and binary)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.5%
  • CMake 3.5%