Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
marchsq::__impl Namespace Reference

Classes

class  Grid
 

Typedefs

template<class T >
using RasterTraits = _RasterTraits< std::decay_t< T > >
 
template<class T >
using TRasterValue = typename RasterTraits< T >::ValueType
 

Enumerations

enum class  SquareTag : uint8_t {
  none , a , b , ab ,
  c , ac , bc , abc ,
  d , ad , bd , abd ,
  cd , acd , bcd , full
}
 
enum class  Dir : uint8_t {
  left , down , right , up ,
  none
}
 

Functions

template<class T >
size_t rows (const T &raster)
 
template<class T >
size_t cols (const T &raster)
 
template<class T >
TRasterValue< T > isoval (const T &rst, const Coord &crd)
 
template<class ExecutionPolicy , class It , class Fn >
void for_each (ExecutionPolicy &&policy, It from, It to, Fn &&fn)
 
template<class E >
constexpr std::underlying_type_t< E > _t (E e) noexcept
 
Coord step (const Coord &crd, Dir d)
 
template<class Raster , class ExecutionPolicy >
std::vector< marchsq::Ringexecute_with_policy (ExecutionPolicy &&policy, const Raster &raster, TRasterValue< Raster > isoval, Coord windowsize={})
 
template<class Raster >
std::vector< marchsq::Ringexecute (const Raster &raster, TRasterValue< Raster > isoval, Coord windowsize={})
 

Variables

static const constexpr Dir NEXT_CCW []
 
static const constexpr uint8_t PREV_CCW []
 
const constexpr uint8_t DIRMASKS []
 

Typedef Documentation

◆ RasterTraits

template<class T >
using marchsq::__impl::RasterTraits = typedef _RasterTraits<std::decay_t<T> >

◆ TRasterValue

template<class T >
using marchsq::__impl::TRasterValue = typedef typename RasterTraits<T>::ValueType

Enumeration Type Documentation

◆ Dir

enum class marchsq::__impl::Dir : uint8_t
strong
Enumerator
left 
down 
right 
up 
none 

◆ SquareTag

Function Documentation

◆ _t()

template<class E >
constexpr std::underlying_type_t< E > marchsq::__impl::_t ( e)
constexprnoexcept
89{
90 return static_cast<std::underlying_type_t<E>>(e);
91}

Referenced by marchsq::__impl::Grid< Rst >::is_visited(), marchsq::__impl::Grid< Rst >::scan_rings(), and marchsq::__impl::Grid< Rst >::set_visited().

+ Here is the caller graph for this function:

◆ cols()

template<class T >
size_t marchsq::__impl::cols ( const T &  raster)
61{
62 return RasterTraits<T>::cols(raster);
63}
Definition MarchingSquares.hpp:29

References marchsq::_RasterTraits< T, Enable >::cols().

Referenced by marchsq::__impl::Grid< Rst >::edge(), and marchsq::__impl::Grid< Rst >::is_within().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ execute()

template<class Raster >
std::vector< marchsq::Ring > marchsq::__impl::execute ( const Raster &  raster,
TRasterValue< Raster >  isoval,
Coord  windowsize = {} 
)
436 {})
437{
438 return execute_with_policy(nullptr, raster, isoval, windowsize);
439}

References execute().

Referenced by execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ execute_with_policy()

template<class Raster , class ExecutionPolicy >
std::vector< marchsq::Ring > marchsq::__impl::execute_with_policy ( ExecutionPolicy &&  policy,
const Raster &  raster,
TRasterValue< Raster >  isoval,
Coord  windowsize = {} 
)
412 {})
413{
414 if (!rows(raster) || !cols(raster)) return {};
415
416 size_t ratio = cols(raster) / rows(raster);
417
418 if (!windowsize.r) windowsize.r = 2;
419 if (!windowsize.c)
420 windowsize.c = std::max(2l, long(windowsize.r * ratio));
421
422 Coord overlap{1};
423
424 Grid<Raster> grid{raster, windowsize, overlap};
425
426 grid.tag_grid(std::forward<ExecutionPolicy>(policy), isoval);
427 std::vector<marchsq::Ring> rings = grid.scan_rings();
428 grid.interpolate_rings(std::forward<ExecutionPolicy>(policy), rings, isoval);
429
430 return rings;
431}
IGL_INLINE void grid(const Eigen::MatrixBase< Derivedres > &res, Eigen::PlainObjectBase< DerivedGV > &GV)
Definition grid.cpp:13
long c
Definition MarchingSquares.hpp:14
long r
Definition MarchingSquares.hpp:14

References execute_with_policy().

Referenced by execute_with_policy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ for_each()

template<class ExecutionPolicy , class It , class Fn >
void marchsq::__impl::for_each ( ExecutionPolicy &&  policy,
It  from,
It  to,
Fn &&  fn 
)
72{
74}
Definition MarchingSquares.hpp:43

References marchsq::_Loop< ExecutionPolicy, Enable >::for_each().

Referenced by marchsq::__impl::Grid< Rst >::interpolate_rings(), and marchsq::__impl::Grid< Rst >::tag_grid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isoval()

template<class T >
TRasterValue< T > marchsq::__impl::isoval ( const T &  rst,
const Coord crd 
)
66{
67 return RasterTraits<T>::get(rst, crd.r, crd.c);
68}

References marchsq::Coord::c, marchsq::_RasterTraits< T, Enable >::get(), and marchsq::Coord::r.

Referenced by marchsq::__impl::Grid< Rst >::get_tag_for_cell(), marchsq::__impl::Grid< Rst >::CellIt::operator*(), and marchsq::__impl::Grid< Rst >::tag_grid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rows()

template<class T >
size_t marchsq::__impl::rows ( const T &  raster)
56{
57 return RasterTraits<T>::rows(raster);
58}

References marchsq::_RasterTraits< T, Enable >::rows().

Referenced by marchsq::__impl::Grid< Rst >::edge(), and marchsq::__impl::Grid< Rst >::is_within().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ step()

Coord marchsq::__impl::step ( const Coord crd,
Dir  d 
)
inline
138{
139 uint8_t dd = DIRMASKS[uint8_t(d)];
140 return {crd.r - 1 + (dd & 0x0f), crd.c - 1 + (dd >> 4)};
141}
const constexpr uint8_t DIRMASKS[]
Definition MarchingSquares.hpp:133

References marchsq::Coord::c, d, DIRMASKS, and marchsq::Coord::r.

Referenced by marchsq::__impl::Grid< Rst >::CellIt::operator++(), and marchsq::__impl::Grid< Rst >::scan_rings().

+ Here is the caller graph for this function:

Variable Documentation

◆ DIRMASKS

const constexpr uint8_t marchsq::__impl::DIRMASKS[]
constexpr
Initial value:
= {
0x01, 0x12, 0x21, 0x10, 0x00
}

Referenced by step().

◆ NEXT_CCW

const constexpr Dir marchsq::__impl::NEXT_CCW[]
staticconstexpr
Initial value:
= {
Dir::none,
Dir::left,
Dir::down,
Dir::left,
Dir::right,
Dir::none,
Dir::down,
Dir::left,
Dir::up,
Dir::up,
Dir::none,
Dir::up,
Dir::right,
Dir::right,
Dir::down,
Dir::none
}

Referenced by marchsq::__impl::Grid< Rst >::next_dir().

◆ PREV_CCW

const constexpr uint8_t marchsq::__impl::PREV_CCW[]
staticconstexpr
Initial value:
= {
1 << _t(Dir::none),
1 << _t(Dir::up),
1 << _t(Dir::left),
1 << _t(Dir::left),
1 << _t(Dir::down),
1 << _t(Dir::up) | 1 << _t(Dir::down),
1 << _t(Dir::down),
1 << _t(Dir::down),
1 << _t(Dir::right),
1 << _t(Dir::up),
1 << _t(Dir::left) | 1 << _t(Dir::right),
1 << _t(Dir::left),
1 << _t(Dir::right),
1 << _t(Dir::up),
1 << _t(Dir::right),
1 << _t(Dir::none)
}
constexpr std::underlying_type_t< E > _t(E e) noexcept
Definition MarchingSquares.hpp:88

Referenced by marchsq::__impl::Grid< Rst >::is_visited().