Blender V4.3
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, 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 71 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, printf, rng_v3_round(), and tree.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ optimal_check_callback()

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

Definition at line 52 of file BLI_kdopbvh_test.cc.

References EXPECT_EQ(), float, and len_squared_v3v3().

Referenced by find_nearest_points_test().

◆ rng_v3_round()

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

Definition at line 19 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 112 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [3/8]

TEST ( kdopbvh ,
FindNearest_2  )

Definition at line 116 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [4/8]

TEST ( kdopbvh ,
FindNearest_500  )

Definition at line 120 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [5/8]

TEST ( kdopbvh ,
OptimalFindNearest_1  )

Definition at line 125 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [6/8]

TEST ( kdopbvh ,
OptimalFindNearest_2  )

Definition at line 129 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [7/8]

TEST ( kdopbvh ,
OptimalFindNearest_500  )

Definition at line 133 of file BLI_kdopbvh_test.cc.

References find_nearest_points_test().

◆ TEST() [8/8]