aimstil  5.0.5
range_tools.h
Go to the documentation of this file.
1 #ifndef TIL_RANGE_TOOLS_H
2 #define TIL_RANGE_TOOLS_H
3 
5 
6 // includes from STL
7 #include <cassert>
8 
9 namespace til
10 {
12  template <typename T, std::size_t D>
14  (
15  Range<T,D> & range,
16  const numeric_array<T,D> & center,
17  const numeric_array<T,D> & halfSize
18  )
19  {
20  range.set_bounds(center - halfSize, center + halfSize);
21  }
22 
24  template <typename T, std::size_t D>
26  (
27  Range<T,D> & range,
28  const numeric_array<T,D> & center,
29  const numeric_array<T,D> & size
30  )
31  {
32  for (int i = 0; i < D; ++i) { assert(size[i]%2); }
33  range.set_bounds(center - size/2, center + size/2);
34  }
35 
36 
37 } // namespace til
38 
39 #endif
40 
void set_bounds(const numeric_array< T, D > &minBounds, const numeric_array< T, D > &maxBounds)
Set min and max bounds.
Definition: Box.h:87
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
numeric_array< T, D > size(const Box< T, D > &box)
Return the size of a box.
Definition: boxTools.h:56
void setCenterAndHalfSizes(Range< T, D > &range, const numeric_array< T, D > &center, const numeric_array< T, D > &halfSize)
Set range using its center and half sizes.
Definition: range_tools.h:14
void setCenterAndSizes(Range< T, D > &range, const numeric_array< T, D > &center, const numeric_array< T, D > &size)
Set range using its center and its size.
Definition: range_tools.h:26
Describe integer cube ranges (e.g.
Definition: Range.h:71