Blender  V3.3
Functions
BLI_kdopbvh_test.cc File Reference
#include "testing/testing.h"
#include "MEM_guardedalloc.h"
#include "BLI_compiler_attrs.h"
#include "BLI_kdopbvh.h"
#include "BLI_math_vector.h"
#include "BLI_rand.h"

Go to the source code of this file.

Functions

static void rng_v3_round (float *coords, int coords_len, struct RNG *rng, int round, float scale)
 
 TEST (kdopbvh, Empty)
 
 TEST (kdopbvh, Single)
 
static void optimal_check_callback (void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
 
static void find_nearest_points_test (int points_len, float scale, int round, int random_seed, bool optimal=false)
 
 TEST (kdopbvh, FindNearest_1)
 
 TEST (kdopbvh, FindNearest_2)
 
 TEST (kdopbvh, FindNearest_500)
 
 TEST (kdopbvh, OptimalFindNearest_1)
 
 TEST (kdopbvh, OptimalFindNearest_2)
 
 TEST (kdopbvh, OptimalFindNearest_500)
 

Function Documentation

◆ find_nearest_points_test()

static void find_nearest_points_test ( int  points_len,
float  scale,
int  round,
int  random_seed,
bool  optimal = false 
)
static

Note that a small epsilon is added to the BVH nodes bounds, even if we pass in zero. Use rounding to ensure very close nodes don't cause the wrong node to be found as nearest.

Definition at line 69 of file BLI_kdopbvh_test.cc.

References BLI_bvhtree_balance(), BLI_bvhtree_find_nearest_ex(), BLI_bvhtree_free(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BLI_rng_free(), BLI_rng_new(), BVH_NEAREST_OPTIMAL_ORDER, callback, float(), len_v3v3(), MEM_freeN, MEM_mallocN, optimal_check_callback(), print_v3_id, RNG::rng, rng_v3_round(), and tree.

Referenced by TEST().

◆ optimal_check_callback()

static void optimal_check_callback ( void userdata,
int  index,
const float  co[3],
BVHTreeNearest nearest 
)
static

◆ rng_v3_round()

static void rng_v3_round ( float coords,
int  coords_len,
struct RNG rng,
int  round,
float  scale 
)
static

Definition at line 17 of file BLI_kdopbvh_test.cc.

References BLI_rng_get_float(), and float().

Referenced by find_nearest_points_test().

◆ TEST() [1/8]

TEST ( kdopbvh  ,
Empty   
)

◆ TEST() [2/8]

TEST ( kdopbvh  ,
FindNearest_1   
)

Definition at line 110 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [3/8]

TEST ( kdopbvh  ,
FindNearest_2   
)

Definition at line 114 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [4/8]

TEST ( kdopbvh  ,
FindNearest_500   
)

Definition at line 118 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [5/8]

TEST ( kdopbvh  ,
OptimalFindNearest_1   
)

Definition at line 123 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [6/8]

TEST ( kdopbvh  ,
OptimalFindNearest_2   
)

Definition at line 127 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [7/8]

TEST ( kdopbvh  ,
OptimalFindNearest_500   
)

Definition at line 131 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [8/8]

TEST ( kdopbvh  ,
Single   
)