5#include "testing/testing.h"
21 for (
int i = 0;
i < coords_len;
i++) {
61 EXPECT_EQ_ARRAY(co, points[index], 3);
63 nearest->
index = index;
72 int points_len,
float scale,
int round,
int random_seed,
bool optimal =
false)
80 for (
int i = 0;
i < points_len;
i++) {
90 for (
int i = 0;
i < points_len;
i++) {
94 const float dist =
len_v3v3(points[
i], points[j]);
95 if (dist > (1.0f /
float(
round))) {
96 printf(
"%.15f (%d %d)\n", dist,
i, j);
103 EXPECT_LT(j, points_len);
104 EXPECT_EQ_ARRAY(points[
i], points[j], 3);
125TEST(kdopbvh, OptimalFindNearest_1)
129TEST(kdopbvh, OptimalFindNearest_2)
133TEST(kdopbvh, OptimalFindNearest_500)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_balance(BVHTree *tree)
void BLI_bvhtree_free(BVHTree *tree)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
void(*)(void *userdata, int index, const float co[3], BVHTreeNearest *nearest) BVHTree_NearestPointCallback
int BLI_bvhtree_get_len(const BVHTree *tree)
@ BVH_NEAREST_OPTIMAL_ORDER
int BLI_bvhtree_find_nearest_ex(const BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata, int flag)
static void optimal_check_callback(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
static void rng_v3_round(float *coords, int coords_len, RNG *rng, int round, float scale)
static void find_nearest_points_test(int points_len, float scale, int round, int random_seed, bool optimal=false)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
struct RNG * BLI_rng_new(unsigned int seed)
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Read Guarded memory(de)allocation.
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)