libslic3r
Library for generating gcode from 3d models
Public Member Functions | Public Attributes | List of all members
Slic3r::TriangleMeshSlicer< A > Class Template Reference

Class for processing TriangleMesh objects. More...

#include <TriangleMesh.hpp>

Public Member Functions

 TriangleMeshSlicer (TriangleMesh *_mesh)
 
 ~TriangleMeshSlicer ()
 
void slice (const std::vector< float > &z, std::vector< Polygons > *layers) const
 
void slice (const std::vector< float > &z, std::vector< ExPolygons > *layers) const
 
void slice (float z, ExPolygons *slices) const
 
void slice_facet (float slice_z, const stl_facet &facet, const int &facet_idx, const float &min_z, const float &max_z, std::vector< IntersectionLine > *lines, boost::mutex *lines_mutex=NULL) const
 
void cut (float z, TriangleMesh *upper, TriangleMesh *lower) const
 Splits the current mesh into two parts. More...
 

Public Attributes

TriangleMeshmesh
 

Detailed Description

template<Axis A>
class Slic3r::TriangleMeshSlicer< A >

Class for processing TriangleMesh objects.

Constructor & Destructor Documentation

◆ TriangleMeshSlicer()

template<Axis A>
Slic3r::TriangleMeshSlicer< A >::TriangleMeshSlicer ( TriangleMesh _mesh)

◆ ~TriangleMeshSlicer()

template<Axis A>
Slic3r::TriangleMeshSlicer< A >::~TriangleMeshSlicer ( )

Member Function Documentation

◆ cut()

template<Axis A>
void Slic3r::TriangleMeshSlicer< A >::cut ( float  z,
TriangleMesh upper,
TriangleMesh lower 
) const

Splits the current mesh into two parts.

Parameters
[in]zCoordinate plane to cut along.
[out]upperTriangleMesh object to add the mesh > z. NULL suppresses saving this.
[out]lowerTriangleMesh object to save the mesh < z. NULL suppresses saving this.

◆ slice() [1/3]

template<Axis A>
void Slic3r::TriangleMeshSlicer< A >::slice ( const std::vector< float > &  z,
std::vector< Polygons > *  layers 
) const

This method gets called with a list of unscaled Z coordinates and outputs a vector pointer having the same number of items as the original list. Each item is a vector of polygons created by slicing our mesh at the given heights.

This method should basically combine the behavior of the existing Perl methods defined in lib/Slic3r/TriangleMesh.pm:

  • analyze(): this creates the 'facets_edges' and the 'edges_facets' tables (we don't need the 'edges' table)
  • slice_facet(): this has to be done for each facet. It generates intersection lines with each plane identified by the Z list. The get_layer_range() binary search used to identify the Z range of the facet is already ported to C++ (see Object.xsp)
  • make_loops(): this has to be done for each layer. It creates polygons from the lines generated by the previous step.

    At the end, we free the tables generated by analyze() as we don't need them anymore.

    NOTE: this method accepts a vector of floats because the mesh coordinate type is float.

◆ slice() [2/3]

template<Axis A>
void Slic3r::TriangleMeshSlicer< A >::slice ( const std::vector< float > &  z,
std::vector< ExPolygons > *  layers 
) const

◆ slice() [3/3]

template<Axis A>
void Slic3r::TriangleMeshSlicer< A >::slice ( float  z,
ExPolygons slices 
) const

◆ slice_facet()

template<Axis A>
void Slic3r::TriangleMeshSlicer< A >::slice_facet ( float  slice_z,
const stl_facet &  facet,
const int &  facet_idx,
const float &  min_z,
const float &  max_z,
std::vector< IntersectionLine > *  lines,
boost::mutex *  lines_mutex = NULL 
) const

Member Data Documentation

◆ mesh

template<Axis A>
TriangleMesh* Slic3r::TriangleMeshSlicer< A >::mesh

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