cgv
stl_reader::StlMesh< TNumber, TIndex > Class Template Reference

convenience mesh class which makes accessing the stl data more easy More...

#include <stl_reader.h>

Public Member Functions

 StlMesh ()
 initializes an empty mesh
 
size_t num_vrts () const
 returns the number of vertices in the mesh
 
const TNumber * vrt_coords (const size_t vi) const
 returns an array of 3 floating point values, one for each coordinate of the vertex
 
size_t num_tris () const
 returns the number of triangles in the mesh
 
const TIndex * tri_corner_inds (const size_t ti) const
 returns an array of 3 indices, one for each corner vertex of the triangle
 
const TIndex tri_corner_ind (const size_t ti, const size_t ci) const
 returns the index of the corner with index 0<=ci<3 of triangle ti
 
const TNumber * tri_corner_coords (const size_t ti, const size_t ci) const
 returns an array of 3 floating point values, one for each coordinate of the specified corner of the specified tri. More...
 
const TNumber * tri_normal (const size_t ti) const
 returns an array of 3 floating point values defining the normal of a tri
 
size_t num_solids () const
 returns the number of solids of the mesh More...
 
TIndex solid_tris_begin (const size_t si) const
 returns the index of the first triangle in the given solid
 
TIndex solid_tris_end (const size_t si) const
 returns the index of the triangle behind the last triangle in the given solid
 
const TNumber * raw_coords () const
 returns a pointer to the coordinate array, containing num_vrts()*3 entries. More...
 
const TNumber * raw_normals () const
 returns a pointer to the normal array, containing num_tris()*3 entries. More...
 
const TIndex * raw_tris () const
 returns a pointer to the triangle array, containing num_tris()*3 entries. More...
 
const TIndex * raw_solids () const
 returns a pointer to the solids array, containing num_solids()+1 entries. More...
 
 StlMesh (const char *filename)
 initializes the mesh from the stl-file specified through filename
 
bool read_file (const char *filename)
 fills the mesh with the contents of the specified stl-file
 

Detailed Description

template<class TNumber = float, class TIndex = unsigned int>
class stl_reader::StlMesh< TNumber, TIndex >

convenience mesh class which makes accessing the stl data more easy

Member Function Documentation

◆ num_solids()

template<class TNumber = float, class TIndex = unsigned int>
size_t stl_reader::StlMesh< TNumber, TIndex >::num_solids ( ) const
inline

returns the number of solids of the mesh

solids can be seen as a partitioning of the triangles of a mesh. By iterating consecutively from the index of the first triangle of a solid si (using solid_tris_begin(si)) to the index of the last triangle of a solid (using solid_tris_end(...)-1), one visits all triangles of the solid si.

◆ raw_coords()

template<class TNumber = float, class TIndex = unsigned int>
const TNumber* stl_reader::StlMesh< TNumber, TIndex >::raw_coords ( ) const
inline

returns a pointer to the coordinate array, containing num_vrts()*3 entries.

Storage layout: x0,y0,z0,x1,y1,z1,...

Returns
pointer to a contiguous array of numbers, or NULL if no coords exist.

◆ raw_normals()

template<class TNumber = float, class TIndex = unsigned int>
const TNumber* stl_reader::StlMesh< TNumber, TIndex >::raw_normals ( ) const
inline

returns a pointer to the normal array, containing num_tris()*3 entries.

Storage layout: nx0,ny0,nz0,nx1,ny1,nz1,...

Returns
pointer to a contiguous array of numbers, or NULL if no normals exist.

◆ raw_solids()

template<class TNumber = float, class TIndex = unsigned int>
const TIndex* stl_reader::StlMesh< TNumber, TIndex >::raw_solids ( ) const
inline

returns a pointer to the solids array, containing num_solids()+1 entries.

Storage layout: s0begin, s0end/s1begin, s1end/s2begin, ..., sNend

Returns
pointer to a contiguous array of indices, or NULL if no solids exist.

◆ raw_tris()

template<class TNumber = float, class TIndex = unsigned int>
const TIndex* stl_reader::StlMesh< TNumber, TIndex >::raw_tris ( ) const
inline

returns a pointer to the triangle array, containing num_tris()*3 entries.

Storage layout: t0c0,t0c1,t0c2,t1c0,t1c1,t1c2,...

Returns
pointer to a contiguous array of indices, or NULL if no tris exist.

◆ tri_corner_coords()

template<class TNumber = float, class TIndex = unsigned int>
const TNumber* stl_reader::StlMesh< TNumber, TIndex >::tri_corner_coords ( const size_t  ti,
const size_t  ci 
) const
inline

returns an array of 3 floating point values, one for each coordinate of the specified corner of the specified tri.

Note
same result as calling on a StlMesh mesh:
mesh.vrt_coords (mesh.tri_corner_ind (itri, icorner))

The documentation for this class was generated from the following file: