OrcaSlicer latest
OrcaSlicer
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_t > m_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)
1098{
1099 // prepare offsets
1100 m_offsets.reserve(cuts.size());
1101 uint32_t offset = 0;
1102 for (const CutAOIs &model_cuts: cuts) {
1103 m_offsets.push_back(offset);
1104 offset += model_cuts.size();
1105 }
1106 m_count = offset;
1107}
std::vector< uint32_t > m_offsets
Definition CutSurface.cpp:358
uint32_t m_count
Definition CutSurface.cpp:360
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582
std::vector< CutAOI > CutAOIs
Definition CutSurface.cpp:279

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
1120{
1121 assert(index < m_count);
1122 ModelCutId result{0,0};
1123 // find shape index
1124 for (size_t model_index = 1; model_index < m_offsets.size(); ++model_index) {
1125 if (m_offsets[model_index] > index) break;
1126 result.model_index = model_index;
1127 }
1128 result.cut_index = index - m_offsets[result.model_index];
1129 return result;
1130}

References priv::ModelCutId::cut_index, m_count, m_offsets, and priv::ModelCutId::model_index.

◆ calc_index()

uint32_t priv::ModelCut2index::calc_index ( const ModelCutId & id) const
1110{
1111 assert(id.model_index < m_offsets.size());
1112 uint32_t offset = m_offsets[id.model_index];
1113 uint32_t res = offset + id.cut_index;
1114 assert(((id.model_index+1) < m_offsets.size() && res < m_offsets[id.model_index+1]) ||
1115 ((id.model_index+1) == m_offsets.size() && res < m_count));
1116 return res;
1117}

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

Here is the call graph for this function:

◆ get_count()

uint32_t priv::ModelCut2index::get_count ( ) const
inline
366{ 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
367{ 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

◆ m_offsets

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

The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/CutSurface.cpp