BRL-CAD
Collaboration diagram for Vertex Trees:

Files

file  vert_tree.c
 Routines to manage a binary search tree of vertices.
 

Data Structures

struct  vert_root
 Vertex tree support Routines to manage a binary search tree of vertices. More...
 
union  vert_tree
 
struct  vert_tree::vert_node
 
struct  vert_tree::vert_leaf
 

Macros

#define TREE_TYPE_VERTS   1
 
#define TREE_TYPE_VERTS_AND_NORMS   2
 
#define VERT_BLOCK   512
 number of vertices to malloc per call when building the array More...
 
#define BN_CK_VERT_TREE(_p)   BU_CKMAG(_p, VERT_TREE_MAGIC, "vert_tree")
 
#define VERT_LEAF   'l'
 
#define VERT_NODE   'n'
 

Functions

struct vert_rootcreate_vert_tree (void)
 routine to create a vertex tree. More...
 
struct vert_rootcreate_vert_tree_w_norms (void)
 routine to create a vertex tree. More...
 
void free_vert_tree (struct vert_root *tree_root)
 Routine to free a vertex tree and all associated dynamic memory. More...
 
int Add_vert (double x, double y, double z, struct vert_root *tree_root, fastf_t local_tol_sq)
 Routine to add a vertex to the current list of part vertices. The array is re-alloc'd if needed. Returns index into the array of vertices where this vertex is stored. More...
 
int Add_vert_and_norm (double x, double y, double z, double nx, double ny, double nz, struct vert_root *tree_root, fastf_t local_tol_sq)
 Routine to add a vertex and a normal to the current list of part vertices. The array is re-alloc'd if needed. Returns index into the array of vertices where this vertex and normal is stored. More...
 
void clean_vert_tree (struct vert_root *tree_root)
 Routine to free the binary search tree and reset the current number of vertices. The vertex array is left untouched, for re-use later. More...
 

Detailed Description

Macro Definition Documentation

#define TREE_TYPE_VERTS   1

Definition at line 59 of file vert_tree.h.

Referenced by Add_vert(), and create_vert_tree().

#define TREE_TYPE_VERTS_AND_NORMS   2

Definition at line 60 of file vert_tree.h.

Referenced by Add_vert_and_norm(), and create_vert_tree_w_norms().

#define VERT_BLOCK   512

number of vertices to malloc per call when building the array

Definition at line 62 of file vert_tree.h.

Referenced by Add_vert(), Add_vert_and_norm(), create_vert_tree(), and create_vert_tree_w_norms().

#define BN_CK_VERT_TREE (   _p)    BU_CKMAG(_p, VERT_TREE_MAGIC, "vert_tree")

Definition at line 64 of file vert_tree.h.

Referenced by Add_vert(), Add_vert_and_norm(), clean_vert_tree(), and free_vert_tree().

#define VERT_LEAF   'l'

Definition at line 75 of file vert_tree.c.

Referenced by Add_vert(), and Add_vert_and_norm().

#define VERT_NODE   'n'

Definition at line 76 of file vert_tree.c.

Referenced by Add_vert(), and Add_vert_and_norm().

Function Documentation

struct vert_root * create_vert_tree ( void  )

routine to create a vertex tree.

Possible refinements include specifying an initial size

Definition at line 80 of file vert_tree.c.

References BU_ALLOC, bu_malloc(), vert_root::curr_vert, vert_root::magic, vert_root::max_vert, vert_root::the_array, vert_root::the_tree, vert_root::tree_type, TREE_TYPE_VERTS, VERT_BLOCK, and VERT_TREE_MAGIC.

Referenced by gcv_stl_read(), and tesselate_pipe_bend().

Here is the call graph for this function:

struct vert_root * create_vert_tree_w_norms ( void  )

routine to create a vertex tree.

Possible refinements include specifying an initial size

Definition at line 96 of file vert_tree.c.

References BU_ALLOC, bu_malloc(), vert_root::curr_vert, vert_root::magic, vert_root::max_vert, vert_root::the_array, vert_root::the_tree, vert_root::tree_type, TREE_TYPE_VERTS_AND_NORMS, VERT_BLOCK, and VERT_TREE_MAGIC.

Here is the call graph for this function:

void free_vert_tree ( struct vert_root tree_root)

Routine to free a vertex tree and all associated dynamic memory.

Definition at line 155 of file vert_tree.c.

References BN_CK_VERT_TREE, bu_free(), vert_root::curr_vert, vert_root::max_vert, vert_root::the_array, and vert_root::the_tree.

Referenced by tesselate_pipe_bend().

Here is the call graph for this function:

int Add_vert ( double  x,
double  y,
double  z,
struct vert_root tree_root,
fastf_t  local_tol_sq 
)

Routine to add a vertex to the current list of part vertices. The array is re-alloc'd if needed. Returns index into the array of vertices where this vertex is stored.

Definition at line 181 of file vert_tree.c.

References BN_CK_VERT_TREE, BU_ALLOC, bu_bomb(), bu_realloc(), vert_tree::vert_node::coord, vert_root::curr_vert, vert_tree::vert_node::cut_val, vert_tree::vert_node::higher, vert_tree::vert_leaf::index, vert_tree::vert_node::lower, vert_root::max_vert, vert_root::the_array, vert_root::the_tree, vert_root::tree_type, TREE_TYPE_VERTS, vert_tree::type, VERT_BLOCK, VERT_LEAF, VERT_NODE, vert_tree::vleaf, vert_tree::vnode, and VSET.

Referenced by tesselate_pipe_bend().

Here is the call graph for this function:

int Add_vert_and_norm ( double  x,
double  y,
double  z,
double  nx,
double  ny,
double  nz,
struct vert_root tree_root,
fastf_t  local_tol_sq 
)

Routine to add a vertex and a normal to the current list of part vertices. The array is re-alloc'd if needed. Returns index into the array of vertices where this vertex and normal is stored.

Definition at line 300 of file vert_tree.c.

References BN_CK_VERT_TREE, BU_ALLOC, bu_bomb(), bu_realloc(), vert_tree::vert_node::coord, vert_root::curr_vert, vert_tree::vert_node::cut_val, vert_tree::vert_node::higher, vert_tree::vert_leaf::index, vert_tree::vert_node::lower, vert_root::max_vert, vert_root::the_array, vert_root::the_tree, vert_root::tree_type, TREE_TYPE_VERTS_AND_NORMS, vert_tree::type, VERT_BLOCK, VERT_LEAF, VERT_NODE, vert_tree::vleaf, vert_tree::vnode, and VSET.

Here is the call graph for this function:

void clean_vert_tree ( struct vert_root tree_root)

Routine to free the binary search tree and reset the current number of vertices. The vertex array is left untouched, for re-use later.

Definition at line 128 of file vert_tree.c.

References BN_CK_VERT_TREE, vert_root::curr_vert, and vert_root::the_tree.