Geometry Node: Index of Nearest #104619
|
@ -107,10 +107,10 @@ inline void BLI_kdtree_nd_(range_search_cb_cpp)(const KDTree *tree,
|
|||
}
|
||||
|
||||
template<typename Fn>
|
||||
inline int BLI_kdtree_nd_(find_nearest_cb)(const KDTree *tree,
|
||||
const float co[KD_DIMS],
|
||||
KDTreeNearest *r_nearest,
|
||||
const Fn &fn)
|
||||
inline int BLI_kdtree_nd_(find_nearest_cb_cpp)(const KDTree *tree,
|
||||
mod_moder marked this conversation as resolved
Outdated
|
||||
const float co[KD_DIMS],
|
||||
KDTreeNearest *r_nearest,
|
||||
const Fn &fn)
|
||||
Jacques Lucke
commented
Can just use Can just use `Fn &&fn`, then you also don't need the const cast below I think.
Iliya Katushenock
commented
Should i also change one other _cpp wrapper above? Should i also change one other _cpp wrapper above?
Jacques Lucke
commented
Just keep other code as is right now. Just keep other code as is right now.
|
||||
{
|
||||
return BLI_kdtree_nd_(find_nearest_cb)(
|
||||
tree,
|
||||
|
|
|
@ -111,7 +111,7 @@ class IndexOfNearestFieldInput final : public bke::GeometryFieldInput {
|
|||
protected:
|
||||
mod_moder marked this conversation as resolved
Outdated
Jacques Lucke
commented
While forest is used as a technical term for a graph containing multiple trees, I don't think the term should be used for a collection of multiple independent kd trees. Just use While forest is used as a technical term for a graph containing multiple trees, I don't think the term should be used for a collection of multiple independent kd trees. Just use `kdtrees`.
Iliya Katushenock
commented
If i do merge If i do merge `parallel_for`s below, i can delete this vector.
|
||||
int kdtree_find_neighboard(KDTree_3d *tree, const float3 &position, int index) const
|
||||
{
|
||||
return BLI_kdtree_3d_find_nearest_cb(
|
||||
return BLI_kdtree_3d_find_nearest_cb_cpp(
|
||||
mod_moder marked this conversation as resolved
Outdated
Hans Goudey
commented
I think this should be I think this should be `!mask_is_cheap`
Iliya Katushenock
commented
I was isn't invented the best name, I was isn't invented the best name, `mask_is_cheap` == true if computing of indices make sense and cheap mask is used.
|
||||
tree,
|
||||
Hans Goudey
commented
TBH I think it's better to just use TBH I think it's better to just use `int64_t` here to avoid duplicating the functions above. Eventually when `IndexMask` is refactored, these could benefit from using that, and the `int64_t` will make that more clear too.
|
||||
position,
|
||||
mod_moder marked this conversation as resolved
Outdated
Hans Goudey
commented
`Vector` -> `Array` here
|
||||
0,
|
||||
|
|
Might as well be consistent with the other function here and use the
_cpp
suffix too.