8 const Eigen::IOFormat VoxelLine::iof{3, 0,
" ",
" ",
"",
"",
"[",
"]"};
15 const Eigen::Vector3i& end,
18 start(start), end(end), includeStart(includeStart), includeEnd(includeEnd)
29 for (Index i = 0; i < step.size(); ++i)
31 step(i) = delta(i) >= 0 ? 1 : -1;
34 delta = delta.cwiseAbs();
42 py = 2 * delta(y) - delta(
x);
43 pz = 2 * delta(z) - delta(
x);
49 if (!includeStart && !(includeEnd && start == end))
58 if (_next(x) != end(x))
82 if (_next(x) == end(x) && !includeEnd)
100 throw std::logic_error(
"No more voxels on the line. "
101 "Check VoxelLine::finished() before calling VoxelLine::next().");
104 Eigen::Vector3i
next = _next;
109 std::vector<Eigen::Vector3i>
111 const Eigen::Vector3i& end,
115 VoxelLine line(start, end, includeStart, includeEnd);
116 std::vector<Eigen::Vector3i> points;
120 points.push_back(line.
next());
VoxelLine()
Construct an empty voxel line.
Eigen::Vector3i next()
Get the next voxel.
static std::vector< Eigen::Vector3i > getLineVoxels(const Eigen::Vector3i &start, const Eigen::Vector3i &end, bool includeStart=true, bool includeEnd=true)
Get the voxels indices of the line from start to end.
bool finished() const
Indicate whether there are more voxels on the line.
This file offers overloads of toIce() and fromIce() functions for STL container types.