9 const Eigen::IOFormat VoxelLine::iof{3, 0,
" ",
" ",
"",
"",
"[",
"]"};
16 const Eigen::Vector3i& start,
const Eigen::Vector3i& end,
17 bool includeStart,
bool includeEnd) :
18 start(start), end(end), includeStart(includeStart), includeEnd(includeEnd)
24 void VoxelLine::init()
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))
55 void VoxelLine::advance()
57 if (_next(x) != end(x))
81 if (_next(x) == end(x) && !includeEnd)
98 throw std::logic_error(
"No more voxels on the line. "
99 "Check VoxelLine::finished() before calling VoxelLine::next().");
102 Eigen::Vector3i
next = _next;
109 const Eigen::Vector3i& start,
const Eigen::Vector3i& end,
110 bool includeStart,
bool includeEnd)
112 VoxelLine line(start, end, includeStart, includeEnd);
113 std::vector<Eigen::Vector3i> points;
117 points.push_back(line.
next());