Blender  V2.59
Classes | Typedefs | Functions
bvhutils.c File Reference
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "DNA_meshdata_types.h"
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BLI_math.h"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Classes

struct  BVHCacheItem

Typedefs

typedef struct BVHCacheItem BVHCacheItem

Functions

static float ray_tri_intersection (const BVHTreeRay *ray, const float UNUSED(m_dist), const float *v0, const float *v1, const float *v2)
static float sphereray_tri_intersection (const BVHTreeRay *ray, float radius, const float m_dist, const float *v0, const float *v1, const float *v2)
static float nearest_point_in_tri_surface (const float *v0, const float *v1, const float *v2, const float *p, int *v, int *e, float *nearest)
static void mesh_faces_nearest_point (void *userdata, int index, const float *co, BVHTreeNearest *nearest)
static void mesh_faces_spherecast (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
static void mesh_edges_nearest_point (void *userdata, int index, const float *co, BVHTreeNearest *nearest)
BVHTreebvhtree_from_mesh_verts (BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
BVHTreebvhtree_from_mesh_faces (BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
BVHTreebvhtree_from_mesh_edges (BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
void free_bvhtree_from_mesh (struct BVHTreeFromMesh *data)
static void bvhcacheitem_set_if_match (void *_cached, void *_search)
BVHTreebvhcache_find (BVHCache *cache, int type)
void bvhcache_insert (BVHCache *cache, BVHTree *tree, int type)
void bvhcache_init (BVHCache *cache)
static void bvhcacheitem_free (void *_item)
void bvhcache_free (BVHCache *cache)

Detailed Description

Definition in file bvhutils.c.


Typedef Documentation

typedef struct BVHCacheItem BVHCacheItem

Function Documentation

BVHTree* bvhcache_find ( BVHCache cache,
int  type 
)
void bvhcache_free ( BVHCache cache)

Definition at line 787 of file bvhutils.c.

References BLI_linklist_free(), bvhcacheitem_free(), and NULL.

Referenced by DM_release().

void bvhcache_init ( BVHCache cache)

Definition at line 773 of file bvhutils.c.

References NULL.

Referenced by DM_init_funcs().

void bvhcache_insert ( BVHCache cache,
BVHTree tree,
int  type 
)
static void bvhcacheitem_free ( void *  _item) [static]

Definition at line 778 of file bvhutils.c.

References BLI_bvhtree_free(), MEM_freeN(), and BVHCacheItem::tree.

Referenced by bvhcache_free().

static void bvhcacheitem_set_if_match ( void *  _cached,
void *  _search 
) [static]

Definition at line 735 of file bvhutils.c.

References BVHCacheItem::tree, and BVHCacheItem::type.

Referenced by bvhcache_find().

BVHTree* bvhtree_from_mesh_edges ( BVHTreeFromMesh data,
DerivedMesh mesh,
float  epsilon,
int  tree_type,
int  axis 
)
BVHTree* bvhtree_from_mesh_faces ( BVHTreeFromMesh data,
DerivedMesh mesh,
float  epsilon,
int  tree_type,
int  axis 
)
BVHTree* bvhtree_from_mesh_verts ( BVHTreeFromMesh data,
DerivedMesh mesh,
float  epsilon,
int  tree_type,
int  axis 
)
void free_bvhtree_from_mesh ( struct BVHTreeFromMesh data)
static void mesh_edges_nearest_point ( void *  userdata,
int  index,
const float *  co,
BVHTreeNearest nearest 
) [static]
static void mesh_faces_nearest_point ( void *  userdata,
int  index,
const float *  co,
BVHTreeNearest nearest 
) [static]
static void mesh_faces_spherecast ( void *  userdata,
int  index,
const BVHTreeRay ray,
BVHTreeRayHit hit 
) [static]
static float nearest_point_in_tri_surface ( const float *  v0,
const float *  v1,
const float *  v2,
const float *  p,
int *  v,
int *  e,
float *  nearest 
) [static]

Definition at line 86 of file bvhutils.c.

References C, KDL::diff(), fabs(), fabsf, INPR, mul_v3_fl(), T, VECADD, VECCOPY, VECSUB, and simple_enum_gen::w.

Referenced by mesh_faces_nearest_point().

static float ray_tri_intersection ( const BVHTreeRay ray,
const float   UNUSEDm_dist,
const float *  v0,
const float *  v1,
const float *  v2 
) [static]

Definition at line 53 of file bvhutils.c.

References BVHTreeRay::direction, FLT_MAX, isect_ray_tri_v3(), NULL, and BVHTreeRay::origin.

Referenced by mesh_faces_spherecast().

static float sphereray_tri_intersection ( const BVHTreeRay ray,
float  radius,
const float  m_dist,
const float *  v0,
const float *  v1,
const float *  v2 
) [static]