34 #include <boost/chrono.hpp> 42 std::cerr <<
"## Chunk size: " << chunk_size << std::endl;
43 const auto ts = boost::chrono::high_resolution_clock::now();
44 pcl::PointCloud<pcl::PointXYZ> pc;
45 for (
float y = -50.0;
y < 50.0;
y += 0.1)
47 for (
float z = -50.0;
z < 50.0;
z += 0.1)
49 pc.push_back(pcl::PointXYZ(5.0,
y,
z));
50 pc.push_back(pcl::PointXYZ(
y + 10.0, 1.5,
z));
55 const auto tnow = boost::chrono::high_resolution_clock::now();
56 std::cerr <<
"- Generate kdtree: " << boost::chrono::duration<float>(tnow - ts).count() <<
" sec" << std::endl;
58 const auto ts2 = boost::chrono::high_resolution_clock::now();
59 size_t collision_cnt = 0;
62 const auto ts3 = boost::chrono::high_resolution_clock::now();
63 for (
float y = -50.0;
y < 50.0;
y += 1.2)
65 for (
float z = -50.0;
z < 50.0;
z += 1.1)
80 std::cerr <<
"- Collisions: " << collision_cnt <<
"/" << cnt << std::endl;
81 const auto tnow2 = boost::chrono::high_resolution_clock::now();
82 std::cerr <<
"- mcl_3dl::RaycastUsingKDTree Init: " << boost::chrono::duration<float>(ts3 - ts2).count() <<
" sec" 84 std::cerr <<
"- mcl_3dl::RaycastUsingKDTree: " << boost::chrono::duration<float>(tnow2 - ts3).count() <<
" sec" 86 std::cerr << std::endl;
91 std::cerr <<
"## DDA grid size: " << dda_grid_size << std::endl;
92 const auto ts = boost::chrono::high_resolution_clock::now();
93 pcl::PointCloud<pcl::PointXYZ> pc;
94 for (
float y = -50.0;
y < 50.0;
y += 0.1)
96 for (
float z = -50.0;
z < 50.0;
z += 0.1)
98 pc.push_back(pcl::PointXYZ(5.0,
y,
z));
99 pc.push_back(pcl::PointXYZ(
y + 10.0, 1.5,
z));
103 pc.push_back(pcl::PointXYZ(-1.05, -50.05, -50.05));
104 pc.push_back(pcl::PointXYZ(2.05, 50.05, 50.05));
108 const auto tnow = boost::chrono::high_resolution_clock::now();
109 std::cerr <<
"- Generate kdtree: " << boost::chrono::duration<float>(tnow - ts).count() <<
" sec" << std::endl;
111 const auto ts2 = boost::chrono::high_resolution_clock::now();
115 size_t collision_cnt = 0;
117 const auto ts3 = boost::chrono::high_resolution_clock::now();
118 for (
float y = -50.0;
y < 50.0;
y += 1.2)
120 for (
float z = -50.0;
z < 50.0;
z += 1.1)
135 std::cerr <<
"- Collisions: " << collision_cnt <<
"/" << cnt << std::endl;
136 const auto tnow2 = boost::chrono::high_resolution_clock::now();
137 std::cerr <<
"- mcl_3dl::RaycastUsingDDA Init: " << boost::chrono::duration<float>(ts3 - ts2).count() <<
" sec" 139 std::cerr <<
"- mcl_3dl::RaycastUsingDDA: " << boost::chrono::duration<float>(tnow2 - ts3).count() <<
" sec" 141 std::cerr << std::endl;
144 int main(
int argc,
char** argv)
std::shared_ptr< ChunkedKdtree > Ptr
void setInputCloud(const typename pcl::PointCloud< POINT_TYPE >::ConstPtr &cloud)
TFSIMD_FORCE_INLINE const tfScalar & y() const
void setRay(typename ChunkedKdtree< POINT_TYPE >::Ptr kdtree, const Vec3 ray_begin, const Vec3 ray_end) final
bool getNextCastResult(CastResult &result) final
void setRay(typename ChunkedKdtree< POINT_TYPE >::Ptr kdtree, const Vec3 ray_begin, const Vec3 ray_end_org) final
TFSIMD_FORCE_INLINE const tfScalar & z() const
bool getNextCastResult(CastResult &result) final