Open dan-jfisher opened 1 year 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.
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.
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.