39 #include "metaprogramming.hxx"
40 #include "numerictraits.hxx"
41 #include "tinyvector.hxx"
48 template<
class VALUETYPE>
49 struct EndInsidePolicy
51 static inline bool isEmptyRange(VALUETYPE b, VALUETYPE e)
56 static inline VALUETYPE pointEnd(VALUETYPE p)
63 template<
class VALUETYPE>
64 struct EndOutsidePolicy
66 static inline bool isEmptyRange(VALUETYPE b, VALUETYPE e)
71 static inline VALUETYPE pointEnd(VALUETYPE p)
87 template<
class VALUETYPE,
unsigned int DIMENSION>
97 typedef typename NumericTraits<VALUETYPE>::Promote
VolumeType;
103 enum { Dimension = DIMENSION };
110 typedef typename If<typename NumericTraits<VALUETYPE>::isIntegral,
111 detail::EndOutsidePolicy<VALUETYPE>,
120 : begin_(NumericTraits<
Vector>::one())
129 : begin_(begin), end_(end)
200 end_ += newBegin - begin_;
223 for(
unsigned int i = 1; i < DIMENSION; ++i)
224 result *= end_[i] - begin_[i];
234 return end_ - begin_;
242 end_ = begin_ +
size;
262 for(
unsigned int i = 0; i < DIMENSION; ++i)
264 begin_[i] -= borderWidth;
265 end_[i] += borderWidth;
272 return (begin_ == r.begin_) && (end_ == r.end_);
278 return (begin_ != r.begin_) || (end_ != r.end_);
291 for(
unsigned int i = 0; i < DIMENSION; ++i)
292 if(RangePolicy::isEmptyRange(begin_[i], end_[i]))
303 for(
unsigned int i = 0; i < DIMENSION; ++i)
304 if((p[i] < begin_[i]) ||
305 RangePolicy::isEmptyRange(p[i], end_[i]))
322 for(
unsigned int i = 0; i < DIMENSION; ++i)
323 if(r.end_[i] > end_[i])
337 for(
unsigned int i = 0; i < DIMENSION; ++i)
338 if(RangePolicy::isEmptyRange(r.begin_[i], end_[i]) ||
339 RangePolicy::isEmptyRange(begin_[i], r.end_[i]))
354 for(
unsigned int i = 0; i < DIMENSION; ++i)
355 end_[i] = RangePolicy::pointEnd(p[i]);
359 for(
unsigned int i = 0; i < DIMENSION; ++i)
363 if(RangePolicy::isEmptyRange(p[i], end_[i]))
364 end_[i] = RangePolicy::pointEnd(p[i]);
391 return this->
operator=(r);
393 for(
unsigned int i = 0; i < DIMENSION; ++i)
395 if(r.begin_[i] < begin_[i])
396 begin_[i] = r.begin_[i];
397 if(end_[i] < r.end_[i])
424 return this->
operator=(r);
426 for(
unsigned int i = 0; i < DIMENSION; ++i)
428 if(begin_[i] < r.begin_[i])
429 begin_[i] = r.begin_[i];
430 if(r.end_[i] < end_[i])
545 #endif // VIGRA_BOX_HXX