Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fixed-size Eigen block expressions in FrustumCulling #2786

Merged
merged 2 commits into from
Jan 20, 2019

Conversation

caselitz
Copy link
Contributor

With the newest version of Eigen, I could not compile PCL

In file included from /usr/local/include/eigen3/Eigen/Core:142:0, from /home/caselitz/software/pcl/common/include/pcl/impl/point_types.hpp:46, from /home/caselitz/software/pcl/common/include/pcl/point_types.h:359, from /home/caselitz/software/pcl/filters/include/pcl/filters/frustum_culling.h:40, from /home/caselitz/software/pcl/filters/include/pcl/filters/impl/frustum_culling.hpp:41, from /home/caselitz/software/pcl/filters/src/frustum_culling.cpp:38: /usr/local/include/eigen3/Eigen/src/Core/Dot.h: In instantiation of ‘typename Eigen::ScalarBinaryOpTraits<typename Eigen::internal::traits<T>::Scalar, typename Eigen::internal::traits<OtherDerived>::Scalar>::ReturnType Eigen::MatrixBase<Derived>::dot(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = Eigen::Block<Eigen::Matrix<float, 4, 1>, -1, -1, false>; Derived = Eigen::Matrix<float, 3, 1>; typename Eigen::ScalarBinaryOpTraits<typename Eigen::internal::traits<T>::Scalar, typename Eigen::internal::traits<OtherDerived>::Scalar>::ReturnType = float]’: /home/caselitz/software/pcl/filters/include/pcl/filters/impl/frustum_culling.hpp:113:24: required from ‘void pcl::FrustumCulling<PointT>::applyFilter(std::vector<int>&) [with PointT = pcl::PointXYZ]’ /home/caselitz/software/pcl/filters/src/frustum_culling.cpp:44:1: required from here /usr/local/include/eigen3/Eigen/src/Core/Dot.h:75:3: error: static assertion failed: YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) ^

This should fix it... replaced Eigen block (0, 0, 3, 1) with head (3).

@caselitz caselitz changed the title Fixed Eigen bug in frustum culling Fix Eigen bug in frustum culling Jan 19, 2019
@taketwo
Copy link
Member

taketwo commented Jan 19, 2019

Thanks for the fix. Since we know the number of elements we want to pick at compile time, what about replacing this with head<3>()? With this the compiler may generate more optimized code, I suppose.

@caselitz
Copy link
Contributor Author

Good point, absolutely agree.

@taketwo taketwo changed the title Fix Eigen bug in frustum culling Use fixed-size Eigen block expressions in Frustum Culling Jan 20, 2019
@taketwo taketwo merged commit 124f0ee into PointCloudLibrary:master Jan 20, 2019
@taketwo taketwo changed the title Use fixed-size Eigen block expressions in Frustum Culling Use fixed-size Eigen block expressions in FrustumCulling Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants