Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::PointGrid< T > Class Template Reference

#include <src/libslic3r/PointGrid.hpp>

+ Collaboration diagram for Slic3r::PointGrid< T >:

Public Member Functions

 PointGrid (std::vector< Vec< 3, T > > data, const Vec3i &size)
 
const Vec< 3, T > & get (size_t idx) const
 
const Vec< 3, T > & get (const Vec3i &coord) const
 
size_t get_idx (const Vec3i &coord) const
 
Vec3i get_coord (size_t idx) const
 
const std::vector< Vec< 3, T > > & data () const
 
size_t point_count () const
 
bool empty () const
 

Private Attributes

Vec3i m_size
 
std::vector< Vec< 3, T > > m_data
 
const int XY
 

Detailed Description

template<class T>
class Slic3r::PointGrid< T >

Constructor & Destructor Documentation

◆ PointGrid()

template<class T >
Slic3r::PointGrid< T >::PointGrid ( std::vector< Vec< 3, T > >  data,
const Vec3i size 
)
inlineexplicit
18 : m_data(std::move(data)), m_size{size}, XY{m_size.x() * m_size.y()}
19 {}
const int XY
Definition PointGrid.hpp:14
Vec3i m_size
Definition PointGrid.hpp:12
std::vector< Vec< 3, T > > m_data
Definition PointGrid.hpp:13
const std::vector< Vec< 3, T > > & data() const
Definition PointGrid.hpp:42
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

Member Function Documentation

◆ data()

template<class T >
const std::vector< Vec< 3, T > > & Slic3r::PointGrid< T >::data ( ) const
inline
42{ return m_data; }

References Slic3r::PointGrid< T >::m_data.

◆ empty()

template<class T >
bool Slic3r::PointGrid< T >::empty ( ) const
inline
44{ return m_data.empty(); }

References Slic3r::PointGrid< T >::m_data.

◆ get() [1/2]

template<class T >
const Vec< 3, T > & Slic3r::PointGrid< T >::get ( const Vec3i coord) const
inline
23 {
24 return m_data[get_idx(coord)];
25 }
size_t get_idx(const Vec3i &coord) const
Definition PointGrid.hpp:27

References Slic3r::PointGrid< T >::get_idx(), and Slic3r::PointGrid< T >::m_data.

+ Here is the call graph for this function:

◆ get() [2/2]

template<class T >
const Vec< 3, T > & Slic3r::PointGrid< T >::get ( size_t  idx) const
inline
21{ return m_data[idx]; }

References Slic3r::PointGrid< T >::m_data.

◆ get_coord()

template<class T >
Vec3i Slic3r::PointGrid< T >::get_coord ( size_t  idx) const
inline
34 {
35 int iz = idx / XY;
36 int iy = (idx / m_size.x()) % m_size.y();
37 int ix = idx % m_size.x();
38
39 return {ix, iy, iz};
40 }

References Slic3r::PointGrid< T >::m_size, and Slic3r::PointGrid< T >::XY.

◆ get_idx()

template<class T >
size_t Slic3r::PointGrid< T >::get_idx ( const Vec3i coord) const
inline
28 {
29 size_t ret = coord.z() * XY + coord.y() * m_size.x() + coord.x();
30
31 return ret;
32 }

References Slic3r::PointGrid< T >::m_size, and Slic3r::PointGrid< T >::XY.

Referenced by Slic3r::PointGrid< T >::get().

+ Here is the caller graph for this function:

◆ point_count()

template<class T >
size_t Slic3r::PointGrid< T >::point_count ( ) const
inline
43{ return m_data.size(); }

References Slic3r::PointGrid< T >::m_data.

Member Data Documentation

◆ m_data

◆ m_size

template<class T >
Vec3i Slic3r::PointGrid< T >::m_size
private

◆ XY

template<class T >
const int Slic3r::PointGrid< T >::XY
private

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