Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_kdtree_impl.h
| Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | BLI_kdtree_nd_(range_search_cb)( | ||||
| co, | co, | ||||
| distance, | distance, | ||||
| [](void *user_data, const int index, const float *co, const float dist_sq) { | [](void *user_data, const int index, const float *co, const float dist_sq) { | ||||
| const Fn &fn = *static_cast<const Fn *>(user_data); | const Fn &fn = *static_cast<const Fn *>(user_data); | ||||
| return fn(index, co, dist_sq); | return fn(index, co, dist_sq); | ||||
| }, | }, | ||||
| const_cast<Fn *>(&fn)); | const_cast<Fn *>(&fn)); | ||||
| } | } | ||||
| 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) | |||||
| { | |||||
| return BLI_kdtree_nd_(find_nearest_cb)( | |||||
| tree, | |||||
| co, | |||||
| [](void *user_data, const int index, const float *co, const float dist_sq) { | |||||
| const Fn &fn = *static_cast<const Fn *>(user_data); | |||||
| return fn(index, co, dist_sq); | |||||
| }, | |||||
| const_cast<Fn *>(&fn), | |||||
| r_nearest); | |||||
| } | |||||
| #endif | #endif | ||||
| #undef _BLI_CONCAT_AUX | #undef _BLI_CONCAT_AUX | ||||
| #undef _BLI_CONCAT | #undef _BLI_CONCAT | ||||
| #undef BLI_kdtree_nd_ | #undef BLI_kdtree_nd_ | ||||