Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
priv::ModelCut2index Class Reference

Keep conversion from VCutAOIs to Index and vice versa Model_index .. contour(or hole) poin from ExPolygons Index .. continous number. More...

+ Collaboration diagram for priv::ModelCut2index:

Public Member Functions

 ModelCut2index (const VCutAOIs &cuts)
 
uint32_t calc_index (const ModelCutId &id) const
 
ModelCutId calc_id (uint32_t index) const
 
uint32_t get_count () const
 
const std::vector< uint32_t > & get_offsets () const
 

Private Attributes

std::vector< uint32_tm_offsets
 
uint32_t m_count
 

Detailed Description

Keep conversion from VCutAOIs to Index and vice versa Model_index .. contour(or hole) poin from ExPolygons Index .. continous number.

Constructor & Destructor Documentation

◆ ModelCut2index()

priv::ModelCut2index::ModelCut2index ( const VCutAOIs cuts)
1060{
1061 // prepare offsets
1062 m_offsets.reserve(cuts.size());
1063 uint32_t offset = 0;
1064 for (const CutAOIs &model_cuts: cuts) {
1065 m_offsets.push_back(offset);
1066 offset += model_cuts.size();
1067 }
1068 m_count = offset;
1069}
std::vector< uint32_t > m_offsets
Definition CutSurface.cpp:324
uint32_t m_count
Definition CutSurface.cpp:326
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, ClipperLib::JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:416
std::vector< CutAOI > CutAOIs
Definition CutSurface.cpp:245
unsigned __int32 uint32_t
Definition unistd.h:79

References m_count, m_offsets, and Slic3r::offset().

+ Here is the call graph for this function:

Member Function Documentation

◆ calc_id()

priv::ModelCutId priv::ModelCut2index::calc_id ( uint32_t  index) const
1082{
1083 assert(index < m_count);
1084 ModelCutId result{0,0};
1085 // find shape index
1086 for (size_t model_index = 1; model_index < m_offsets.size(); ++model_index) {
1087 if (m_offsets[model_index] > index) break;
1088 result.model_index = model_index;
1089 }
1090 result.cut_index = index - m_offsets[result.model_index];
1091 return result;
1092}

References priv::ModelCutId::model_index.

◆ calc_index()

uint32_t priv::ModelCut2index::calc_index ( const ModelCutId id) const
1072{
1073 assert(id.model_index < m_offsets.size());
1074 uint32_t offset = m_offsets[id.model_index];
1075 uint32_t res = offset + id.cut_index;
1076 assert(((id.model_index+1) < m_offsets.size() && res < m_offsets[id.model_index+1]) ||
1077 ((id.model_index+1) == m_offsets.size() && res < m_count));
1078 return res;
1079}

References Slic3r::offset().

+ Here is the call graph for this function:

◆ get_count()

uint32_t priv::ModelCut2index::get_count ( ) const
inline
332{ return m_count; };

References m_count.

Referenced by priv::diff_models(), and priv::has_bb_intersection().

+ Here is the caller graph for this function:

◆ get_offsets()

const std::vector< uint32_t > & priv::ModelCut2index::get_offsets ( ) const
inline
333{ return m_offsets; }

References m_offsets.

Referenced by priv::has_bb_intersection().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_count

uint32_t priv::ModelCut2index::m_count
private

Referenced by ModelCut2index(), and get_count().

◆ m_offsets

std::vector<uint32_t> priv::ModelCut2index::m_offsets
private

Referenced by ModelCut2index(), and get_offsets().


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