32 template<
class Derived>
33 auto filtered(
const Eigen::MatrixBase<Derived>& m)
const {
34 if(m.rows() != n_points_) {
35 throw std::invalid_argument(
"The number of rows of the input matrix must be equal to the number of points in the point cloud.");
37 return common::take_rows(m, filtered_indices_);
40 template <
class Derived,
class ...Args>
41 auto filtered(
const Eigen::MatrixBase<Derived>& m, Args&&... args) {
42 return std::make_tuple(filtered(m), filtered(std::forward<Args>(args))...);
45 template <
class Derived>
46 auto operator() (
const Eigen::MatrixBase<Derived>& m) {
47 if(m.rows() != n_points_) {
48 throw std::invalid_argument(
"The number of rows of the input matrix must be equal to the number of points in the point cloud.");
50 return m(filtered_indices_, Eigen::all).eval();
53 template <
class Derived,
class... Args>
54 auto operator() (
const Eigen::MatrixBase<Derived>& m, Args&&... args) {
55 return std::make_tuple(
operator()(m),
operator()(std::forward<Args>(args))...);
58 [[nodiscard]]
const std::vector<index_t>& filtered_indices()
const {
return filtered_indices_;}
61 static std::vector<index_t> trivial_indices(index_t n_points) {
62 std::vector<index_t> indices(n_points);
63 std::iota(begin(indices), end(indices), 0);
67 const index_t n_points_;
69 std::vector<index_t> filtered_indices_;