Skip to content

Commit

Permalink
Merge pull request #44 from ngchisern/feat/downsample-parallelism
Browse files Browse the repository at this point in the history
Add parallelism to`downsample`
  • Loading branch information
weitsang authored Oct 26, 2023
2 parents 947580f + 084a359 commit 0a215a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Downsamples pcd files and write as ply binary
vv read ./pcd +output=pcdb \
downsample -p 2 +input=pcdb +output=pcdb_down \
write ./pcdb_down \
+input=pcdb_up \
+input=pcdb_down \
--storage-type binary \
--output-format ply
```
Expand Down
6 changes: 4 additions & 2 deletions src/downsample/octree.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::formats::{pointxyzrgba::PointXyzRgba, PointCloud};

use std::iter::zip;
use rayon::prelude::*;

const DELTA: f32 = 1e-4;

Expand Down Expand Up @@ -157,7 +157,9 @@ fn octree_downsample(
}
}

zip(voxels, split_bounds)
voxels
.into_par_iter()
.zip(split_bounds.into_par_iter())
.flat_map(|(p, b)| octree_downsample(p, b, points_per_voxel))
.collect()
}
Expand Down

0 comments on commit 0a215a7

Please sign in to comment.