5#include "testing/testing.h"
23 for (
int i = 0; i < coords_len; i++) {
59 float (*points)[3] =
static_cast<float (*)[3]
>(userdata);
63 EXPECT_EQ_ARRAY(co, points[
index], 3);
74 int points_len,
float scale,
int round,
int random_seed,
bool optimal =
false)
80 float (*points)[3] =
static_cast<float (*)[3]
>(mem);
82 for (
int i = 0; i < points_len; i++) {
92 for (
int i = 0; i < points_len; i++) {
96 const float dist =
len_v3v3(points[i], points[j]);
97 if (dist > (1.0f /
float(
round))) {
98 printf(
"%.15f (%d %d)\n", dist, i, j);
106 EXPECT_EQ_ARRAY(points[i], points[j], 3);
127TEST(kdopbvh, OptimalFindNearest_1)
131TEST(kdopbvh, OptimalFindNearest_2)
135TEST(kdopbvh, OptimalFindNearest_500)
Read Blender memory allocation and freeing.
float3x3 scale(float3x3 mat, float2 scale)
#define EXPECT_LT(result, expect)
#define EXPECT_GE(result, expect)
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
@ BVH_NEAREST_OPTIMAL_ORDER
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BLI_bvhtree_free(BVHTree *tree)
void BLI_bvhtree_balance(BVHTree *tree)
static void optimal_check_callback(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
struct RNG * BLI_rng_new(unsigned int seed)
int BLI_bvhtree_find_nearest_ex(const BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata, int flag)
static void find_nearest_points_test(int points_len, float scale, int round, int random_seed, bool optimal=false)
int BLI_bvhtree_get_len(const BVHTree *tree)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
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)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
static void rng_v3_round(float *coords, int coords_len, RNG *rng, int round, float scale)
void(*)(void *userdata, int index, const float co[3], BVHTreeNearest *nearest) BVHTree_NearestPointCallback
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float