129 if ( c < lower || c >
upper )
145 template <
typename = std::enable_if < ( _vsize > 1 ) > >
147 out_v & result )
const
191 :
lower ( _lower <= _upper ? _lower : _upper ) ,
192 upper ( _upper >= _lower ? _upper : _lower ) ,
193 lfix ( _lower <= _upper ? _lfix : _ufix ) ,
194 ufix ( _upper >= _lower ? _ufix : _lfix )
203 :
clamp_gate ( _lower , _upper , _lower , _upper )
211 else if ( c >
upper )
222 template <
typename = std::enable_if < ( _vsize > 1 ) > >
224 out_v & result )
const
245 ( lower , upper , lfix , rfix ) ;
261template <
typename rc_v>
263 const typename rc_v::value_type & rhs )
267 help = trunc ( help ) ;
272 lhs ( abs(lhs) >= abs(rhs) ) = 0 ;
301 :
lower ( _lower <= _upper ? _lower : _upper ) ,
302 upper ( _upper >= _lower ? _upper : _lower )
313 cc = std::abs ( cc ) ;
317 cc = fmod ( cc , 2 * w ) ;
319 cc = std::abs ( cc ) ;
323 result = cc +
lower ;
331 template <
typename = std::enable_if < ( _vsize > 1 ) > >
333 out_v & result )
const
340 auto mask = ( cc >= w ) ;
343 auto cm =
v_fmod ( cc , 2 * w ) ;
350 result = cc +
lower ;
384 :
lower ( _lower <= _upper ? _lower : _upper ) ,
385 upper ( _upper >= _lower ? _upper : _lower )
396 if ( ( cc < 0 ) || ( cc >= w ) )
398 cc = fmod ( cc , w ) ;
407 result = cc +
lower ;
415 template <
typename = std::enable_if < ( _vsize > 1 ) > >
417 out_v & result )
const
424 auto mask_below = ( cc < 0 ) ;
425 auto mask_above = ( cc >= w ) ;
426 auto mask_any = mask_above | mask_below ;
428 if (
any_of ( mask_any ) )
430 auto cm =
v_fmod ( cc , w ) ;
431 cm ( mask_below ) = ( cm + w ) ;
435 cc ( mask_any ) = cm ;
438 result = cc +
lower ;
463template <
typename nd_rc_type ,
465 class ... gate_types >
477 enum {
dimension = vigra::ExpandElementResult < nd_rc_type > :: size } ;
505 template <
int level ,
int dimension ,
typename nd_coordinate_type >
509 const nd_coordinate_type & in ,
510 nd_coordinate_type & out )
const
512 std::get<level>(
mvec).eval ( in[level] , out[level] ) ;
519 template <
int dimension ,
typename nd_coordinate_type >
523 const nd_coordinate_type & in ,
524 nd_coordinate_type & out )
const
526 std::get<0>(
mvec).eval ( in[0] , out[0] ) ;
532 template <
typename coordinate_type >
539 std::get<0>(
mvec).eval ( in , out ) ;
546 template <
class in_type ,
class out_type >
560template <
typename nd_rc_type ,
562 class ... gate_types >
vigra::TinyVector< float, 2 > coordinate_type
vspline::reject_gate< rc_type, _vsize > reject(rc_type lower, rc_type upper)
factory function to create a reject_gate type functor given a lower and upper limit for the allowed r...
bool any_of(simd_type< T, vsize > arg)
vspline::periodic_gate< rc_type, _vsize > periodic(rc_type lower, rc_type upper)
factory function to create a periodic_gate type functor given a lower and upper limit for the allowed...
vspline::map_functor< nd_rc_type, _vsize, gate_types... > mapper(gate_types ... args)
factory function to create a mapper type functor given a set of gate_type objects....
vspline::clamp_gate< rc_type, _vsize > clamp(rc_type lower, rc_type upper, rc_type lfix, rc_type rfix)
factory function to create a clamp_gate type functor given a lower and upper limit for the allowed ra...
rc_v v_fmod(rc_v lhs, const typename rc_v::value_type &rhs)
vectorized fmod function using std::trunc, which is fast, but checking the result to make sure it's a...
vspline::pass_gate< rc_type, _vsize > pass()
factory function to create a pass_gate type functor
vspline::mirror_gate< rc_type, _vsize > mirror(rc_type lower, rc_type upper)
factory function to create a mirror_gate type functor given a lower and upper limit for the allowed r...
clamp gate clamps out-of-bounds values. clamp_gate takes four arguments: the lower and upper limit of...
vector_traits< IN, vsize >::type in_v
vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional...
void eval(const in_v &c, out_v &result) const
void eval(const rc_type &c, rc_type &result) const
clamp_gate(rc_type _lower, rc_type _upper, rc_type _lfix, rc_type _ufix)
vector_traits< OUT, vsize >::type out_v
clamp_gate(rc_type _lower, rc_type _upper)
simplified constructor, gate clamps to _lower and _upper
vspline::unary_functor< rc_type, rc_type, _vsize > base_type
void operator()(const mvec_type &mvec, const nd_coordinate_type &in, nd_coordinate_type &out) const
finally we define class mapper which is initialized with a set of gate objects (of arbitrary type) wh...
base_type::out_type out_type
vspline::unary_functor< nd_rc_type, nd_rc_type, _vsize > base_type
void eval(const in_type &in, out_type &out) const
map_functor(const mvec_type &_mvec)
base_type::in_type in_type
std::tuple< gate_types... > mvec_type
map_functor(gate_types ... args)
mirror gate 'folds' coordinates into the range. From the infinite number of mirror images resulting f...
vector_traits< IN, vsize >::type in_v
vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional...
vector_traits< OUT, vsize >::type out_v
void eval(const in_v &c, out_v &result) const
void eval(const rc_type &c, rc_type &result) const
vspline::unary_functor< rc_type, rc_type, _vsize > base_type
mirror_gate(rc_type _lower, rc_type _upper)
out_of_bounds is thrown by mapping mode REJECT for out-of-bounds coordinates this exception is left w...
class pass_gate passes it's input to it's output unmodified.
void eval(const T &c, T &result) const
the periodic mapping also folds the incoming value into the allowed range. The resulting value will b...
vector_traits< IN, vsize >::type in_v
vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional...
vspline::unary_functor< rc_type, rc_type, _vsize > base_type
vector_traits< OUT, vsize >::type out_v
periodic_gate(rc_type _lower, rc_type _upper)
void eval(const rc_type &c, rc_type &result) const
void eval(const in_v &c, out_v &result) const
reject_gate throws vspline::out_of_bounds for invalid coordinates
void eval(const in_v &c, out_v &result) const
vector_traits< IN, vsize >::type in_v
vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional...
vector_traits< OUT, vsize >::type out_v
void eval(const rc_type &c, rc_type &result) const
vspline::unary_functor< rc_type, rc_type, _vsize > base_type
vectorized evaluation function. This is enabled only if vsize > 1 to guard against cases where vector...
reject_gate(rc_type _lower, rc_type _upper)
class unary_functor provides a functor object which offers a system of types for concrete unary funct...
vector_traits< IN, vsize >::type in_v
vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional...
vector_traits< OUT, vsize >::type out_v
with the definition of 'simd_traits', we can proceed to implement 'vector_traits': struct vector_trai...
interface definition for unary functors