igd-geo / pasture

Rust library for point cloud processing
Apache License 2.0
69 stars 9 forks source link

add checked attribute view and float generic in compute centroid #24

Open dan-jfisher opened 10 months ago

dan-jfisher commented 10 months ago

23

Downside of this approach is that it requires the user to specify if their pointcloud has f32 or f64 precision.

If it's important, we can maintain backwards compatibility with some clever naming.

\Edit: for centroid, which I used as an example, we could get around that with a private generic function and a public function that always returns f64 and checks the data_type of the point cloud attribute at runtime. I am not crazy about that solution though.

dan-jfisher commented 10 months ago

It would probably be better to take an AttributeView which has already been typed rather than taking the entire cloud. However, if we are going to do that we need to expand AttributeView so that it includes things like len and is_empty.

I am happy to go in that direction though.

dan-jfisher commented 10 months ago

What do you think about making view_attribute_checked the default behavior (i.e. view_attribute) and calling the standard function view_attribute_unchecked?

Regardless, I removed that part of PR so that this one is focused on AttributeView and compute_centroid as PoC for generic algorithms.

We can handle view_attribute_checked vs unchecked in a separate issue.