OrcaSlicer latest
OrcaSlicer
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  Dir : uint8_t {
  none = 0b0000 , left = 0b0001 , down = 0b0010 , right = 0b0100 ,
  leftright = left | right , up = 0b1000 , updown = up | down , all = 0b1111
}

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_idx (ExecutionPolicy &&policy, It from, It to, Fn &&fn)
template<class E>
constexpr std::underlying_type_t< E > _t (E e) noexcept
std::ostream & operator<< (std::ostream &os, const Dir &d)
void step (Coord &crd, const Dir d, const long n=1)
template<class Raster, class ExecutionPolicy>
std::vector< marchsq::Ring > execute_with_policy (ExecutionPolicy &&policy, const Raster &raster, TRasterValue< Raster > isoval, Coord windowsize={})
template<class Raster>
std::vector< marchsq::Ring > execute (const Raster &raster, TRasterValue< Raster > isoval, Coord windowsize={})

Variables

static const constexpr std::array< uint32_t, 16 > NEXT_CCW

Typedef Documentation

◆ RasterTraits

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

◆ TRasterValue

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

Enumeration Type Documentation

◆ Dir

enum class marchsq::__impl::Dir : uint8_t
strong
Enumerator
none 
left 
down 
right 
leftright 
up 
updown 
all 
186 : uint8_t {
187 none = 0b0000,
188 left = 0b0001, /* exit through a-b edge */
189 down = 0b0010, /* exit through b-c edge */
190 right = 0b0100, /* exit through c-d edge */
191 leftright = left | right,
192 up = 0b1000, /* exit through d-a edge */
193 updown = up | down,
194 all = 0b1111
195};
@ none
Definition MarchingSquares.hpp:187
@ updown
Definition MarchingSquares.hpp:193
@ up
Definition MarchingSquares.hpp:192
@ leftright
Definition MarchingSquares.hpp:191
@ down
Definition MarchingSquares.hpp:189
@ right
Definition MarchingSquares.hpp:190
@ left
Definition MarchingSquares.hpp:188
@ all
Definition MarchingSquares.hpp:194

Function Documentation

◆ _t()

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

References Slic3r::E.

Referenced by operator<<().

Here is the caller graph for this function:

◆ cols()

template<class T>
size_t marchsq::__impl::cols ( const T & raster)
173{ return RasterTraits<T>::cols(raster); }
static size_t cols(const T &raster)

References marchsq::_RasterTraits< std::decay_t< T > >::cols().

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

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 = {} )
645 {})
646{
647 return execute_with_policy(nullptr, raster, isoval, windowsize);
648}
std::vector< marchsq::Ring > execute_with_policy(ExecutionPolicy &&policy, const Raster &raster, TRasterValue< Raster > isoval, Coord windowsize={})
Definition MarchingSquares.hpp:621
TRasterValue< T > isoval(const T &rst, const Coord &crd)
Definition MarchingSquares.hpp:175

References isoval().

Here is the call 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 = {} )
624 {})
625{
626 if (!rows(raster) || !cols(raster))
627 return {};
628
629 size_t ratio = cols(raster) / rows(raster);
630
631 if (!windowsize.r)
632 windowsize.r = 2;
633 if (!windowsize.c)
634 windowsize.c = std::max(2l, long(windowsize.r * ratio));
635
636 Grid<Raster> grid{raster, windowsize};
637
638 grid.tag_grid(std::forward<ExecutionPolicy>(policy), isoval);
639 std::vector<marchsq::Ring> rings = grid.scan_rings();
640 grid.interpolate_rings(std::forward<ExecutionPolicy>(policy), rings, isoval);
641
642 return rings;
643}
std::vector< ArithmeticOnly< T > > grid(const T &start, const T &stop, const T &stride)
A set of equidistant values starting from 'start' (inclusive), ending in the closest multiple of 'str...
Definition MTUtils.hpp:127
size_t cols(const T &raster)
Definition MarchingSquares.hpp:173
size_t rows(const T &raster)
Definition MarchingSquares.hpp:171
long c
Definition MarchingSquares.hpp:96
long r
Definition MarchingSquares.hpp:96

References isoval().

Here is the call graph for this function:

◆ for_each_idx()

template<class ExecutionPolicy, class It, class Fn>
void marchsq::__impl::for_each_idx ( ExecutionPolicy && policy,
It from,
It to,
Fn && fn )
178{
180}
static void for_each_idx(It from, It to, Fn &&fn)
Definition MarchingSquares.hpp:149

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

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 )
175{ return RasterTraits<T>::get(rst, crd.r, crd.c); }
static ValueType get(const T &raster, size_t row, size_t col)

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

Referenced by execute(), execute_with_policy(), marchsq::__impl::Grid< Rst >::get_tags_block32(), marchsq::__impl::Grid< Rst >::interpolate_edge(), 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:

◆ operator<<()

std::ostream & marchsq::__impl::operator<< ( std::ostream & os,
const Dir & d )
inline
197{ return os << ".<v#>x##^#X#####"[_t(d)]; }
constexpr std::underlying_type_t< E > _t(E e) noexcept
Definition MarchingSquares.hpp:182

References _t().

Here is the call graph for this function:

◆ rows()

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

References marchsq::_RasterTraits< std::decay_t< T > >::rows().

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

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

◆ step()

void marchsq::__impl::step ( Coord & crd,
const Dir d,
const long n = 1 )
inline
214{
215 switch (d) {
216 case Dir::left: crd.c -= n; break;
217 case Dir::down: crd.r += n; break;
218 case Dir::right: crd.c += n; break;
219 case Dir::up: crd.r -= n; break;
220 }
221}

References marchsq::Coord::c, down, left, marchsq::Coord::r, right, and up.

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

Here is the caller graph for this function:

Variable Documentation

◆ NEXT_CCW

const constexpr std::array<uint32_t, 16> marchsq::__impl::NEXT_CCW
staticconstexpr
Initial value:
= [] {
auto map = decltype(NEXT_CCW){};
for (uint32_t cbda = 0; cbda < 16; cbda++) {
const uint32_t dcba = (cbda & 0b0001) | ((cbda >> 1) & 0b0110) | ((cbda << 2) & 0b1000);
const uint32_t adcb = (dcba >> 1) | ((dcba << 3) & 0b1000);
map[cbda] = ~dcba & adcb;
}
return map;
}()
static const constexpr std::array< uint32_t, 16 > NEXT_CCW
Definition MarchingSquares.hpp:202
202 {
203 auto map = decltype(NEXT_CCW){};
204 for (uint32_t cbda = 0; cbda < 16; cbda++) {
205 const uint32_t dcba = (cbda & 0b0001) | ((cbda >> 1) & 0b0110) | ((cbda << 2) & 0b1000);
206 const uint32_t adcb = (dcba >> 1) | ((dcba << 3) & 0b1000);
207 map[cbda] = ~dcba & adcb;
208 }
209 return map;
210}();

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