CortidQCT  1.2.2.52
VoxelSize.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include <cassert>
15 #include <cstddef>
16 
17 namespace CortidQCT {
18 
22 struct VoxelSize {
24  float width = 0;
26  float height = 0;
28  float depth = 0;
29 
40  inline constexpr float operator[](std::size_t idx) const noexcept {
41  assert(idx < 3 && "Index out of bounds");
42  switch (idx) {
43  case 0:
44  return width;
45  case 1:
46  return height;
47  case 2:
48  return depth;
49  default:
50  return width; // Just to return anything
51  }
52  }
53 
64  inline float &operator[](std::size_t idx) noexcept {
65  assert(idx < 3 && "Index out of bounds");
66  switch (idx) {
67  case 0:
68  return width;
69  case 1:
70  return height;
71  case 2:
72  return depth;
73  default:
74  return width; // Just to return anything
75  }
76  }
77 };
78 
79 } // namespace CortidQCT
Name namespace for CortidQCT library.
Definition: CortidQCT.h:23
constexpr float operator[](std::size_t idx) const noexcept
subscript operator for dimension access
Definition: VoxelSize.h:40
float depth
Size along the z-axis.
Definition: VoxelSize.h:28
Size type for a 3D voxel.
Definition: VoxelSize.h:22
float width
Size along the x-axis.
Definition: VoxelSize.h:24
float height
Size along the y-axis.
Definition: VoxelSize.h:26
float & operator[](std::size_t idx) noexcept
subscript operator for dimension access
Definition: VoxelSize.h:64