Blender  V2.59
Classes | Typedefs | Functions
BLI_kdtree.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_kdtree.h"

Go to the source code of this file.

Classes

struct  KDTreeNode
struct  KDTree

Typedefs

typedef struct KDTreeNode KDTreeNode

Functions

KDTreeBLI_kdtree_new (int maxsize)
void BLI_kdtree_free (KDTree *tree)
void BLI_kdtree_insert (KDTree *tree, int index, float *co, float *nor)
static KDTreeNodekdtree_balance (KDTreeNode *nodes, int totnode, int axis)
void BLI_kdtree_balance (KDTree *tree)
static float squared_distance (float *v2, float *v1, float *n1, float *n2)
int BLI_kdtree_find_nearest (KDTree *tree, float *co, float *nor, KDTreeNearest *nearest)
static void add_nearest (KDTreeNearest *ptn, int *found, int n, int index, float dist, float *co)
int BLI_kdtree_find_n_nearest (KDTree *tree, int n, float *co, float *nor, KDTreeNearest *nearest)
static int range_compare (const void *a, const void *b)
static void add_in_range (KDTreeNearest **ptn, int found, int *totfoundstack, int index, float dist, float *co)
int BLI_kdtree_range_search (KDTree *tree, float range, float *co, float *nor, KDTreeNearest **nearest)

Detailed Description

Definition in file BLI_kdtree.c.


Typedef Documentation

typedef struct KDTreeNode KDTreeNode

Function Documentation

static void add_in_range ( KDTreeNearest **  ptn,
int  found,
int *  totfoundstack,
int  index,
float  dist,
float *  co 
) [static]
static void add_nearest ( KDTreeNearest ptn,
int *  found,
int  n,
int  index,
float  dist,
float *  co 
) [static]

Definition at line 242 of file BLI_kdtree.c.

References copy_v3_v3(), KDTreeNearest::dist, i, and KDTreeNearest::index.

Referenced by BLI_kdtree_find_n_nearest().

void BLI_kdtree_balance ( KDTree tree)
int BLI_kdtree_find_n_nearest ( KDTree tree,
int  n,
float *  co,
float *  nor,
KDTreeNearest nearest 
)
int BLI_kdtree_find_nearest ( KDTree tree,
float *  co,
float *  nor,
KDTreeNearest nearest 
)
void BLI_kdtree_free ( KDTree tree)
void BLI_kdtree_insert ( KDTree tree,
int  index,
float *  co,
float *  nor 
)
KDTree* BLI_kdtree_new ( int  maxsize)
int BLI_kdtree_range_search ( KDTree tree,
float  range,
float *  co,
float *  nor,
KDTreeNearest **  nearest 
)
static KDTreeNode* kdtree_balance ( KDTreeNode nodes,
int  totnode,
int  axis 
) [static]

Definition at line 87 of file BLI_kdtree.c.

References KDTreeNode::co, co, KDTreeNode::d, i, KDTreeNode::left, left, nodes, NULL, KDTreeNode::right, and SWAP.

Referenced by BLI_kdtree_balance().

static int range_compare ( const void *  a,
const void *  b 
) [static]

Definition at line 345 of file BLI_kdtree.c.

References KDTreeNearest::dist.

Referenced by BLI_kdtree_range_search().

static float squared_distance ( float *  v2,
float *  v1,
float *  n1,
float *  n2 
) [static]