Blender V2.61 - r43446
|
#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 "BLI_linklist.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 | |
float | bvhtree_ray_tri_intersection (const BVHTreeRay *ray, const float UNUSED(m_dist), const float v0[3], const float v1[3], const float v2[3]) |
static float | sphereray_tri_intersection (const BVHTreeRay *ray, float radius, const float m_dist, const float v0[3], const float v1[3], const float v2[3]) |
float | nearest_point_in_tri_surface (const float v0[3], const float v1[3], const float v2[3], const float p[3], int *v, int *e, float nearest[3]) |
static void | mesh_faces_nearest_point (void *userdata, int index, const float co[3], 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[3], BVHTreeNearest *nearest) |
BVHTree * | bvhtree_from_mesh_verts (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_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) |
BVHTree * | bvhcache_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) |
Definition in file bvhutils.c.
typedef struct BVHCacheItem BVHCacheItem |
Definition at line 743 of file bvhutils.c.
References BLI_linklist_apply(), bvhcacheitem_set_if_match(), NULL, BVHCacheItem::tree, and BVHCacheItem::type.
Referenced by bvhcache_insert(), bvhtree_from_mesh_edges(), bvhtree_from_mesh_faces(), and bvhtree_from_mesh_verts().
void bvhcache_free | ( | BVHCache * | cache | ) |
Definition at line 784 of file bvhutils.c.
References BLI_linklist_free(), bvhcacheitem_free(), and NULL.
Referenced by DM_release().
void bvhcache_init | ( | BVHCache * | cache | ) |
Definition at line 753 of file bvhutils.c.
References assert, BLI_linklist_prepend(), bvhcache_find(), MEM_mallocN(), NULL, BVHCacheItem::tree, and BVHCacheItem::type.
Referenced by bvhtree_from_mesh_edges(), bvhtree_from_mesh_faces(), and bvhtree_from_mesh_verts().
static void bvhcacheitem_free | ( | void * | _item | ) | [static] |
Definition at line 775 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 732 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 | ||
) |
Definition at line 650 of file bvhutils.c.
References BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), DerivedMesh::bvhCache, bvhcache_find(), bvhcache_insert(), BVHTREE_FROM_EDGES, BVHTreeFromMesh::cached, CD_MEDGE, CD_MVERT, co, copy_v3_v3(), BVHTreeFromMesh::edge, KDL::epsilon, DerivedMesh::getEdgeDataArray, DerivedMesh::getNumEdges, DerivedMesh::getVertDataArray, i, BVHTreeFromMesh::mesh, mesh_edges_nearest_point(), BVHTreeFromMesh::nearest_callback, NULL, BVHTreeFromMesh::raycast_callback, BVHTreeFromMesh::sphere_radius, BVHTreeFromMesh::tree, TRUE, and BVHTreeFromMesh::vert.
Referenced by deformVerts(), and get_vert2geom_distance().
BVHTree* bvhtree_from_mesh_faces | ( | BVHTreeFromMesh * | data, |
DerivedMesh * | mesh, | ||
float | epsilon, | ||
int | tree_type, | ||
int | axis | ||
) |
Definition at line 567 of file bvhutils.c.
References BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), DerivedMesh::bvhCache, bvhcache_find(), bvhcache_insert(), BVHTREE_FROM_FACES, BVHTreeFromMesh::cached, CD_MFACE, CD_MVERT, co, copy_v3_v3(), BVHTreeFromMesh::em_evil, KDL::epsilon, BVHTreeFromMesh::face, EditMesh::faces, ListBase::first, DerivedMesh::getFaceDataArray, DerivedMesh::getNumFaces, DerivedMesh::getVertDataArray, i, BVHTreeFromMesh::mesh, mesh_faces_nearest_point(), mesh_faces_spherecast(), BVHTreeFromMesh::nearest_callback, EditFace::next, NULL, BVHTreeFromMesh::raycast_callback, BVHTreeFromMesh::sphere_radius, BVHTreeFromMesh::tree, TRUE, and BVHTreeFromMesh::vert.
Referenced by connect_hair(), deformVerts(), dynamicPaint_paintMesh(), followtrack_evaluate(), get_vert2geom_distance(), shrinkwrap_calc_nearest_surface_point(), shrinkwrap_calc_normal_projection(), shrinkwrap_get_tarmat(), and snapDerivedMesh().
BVHTree* bvhtree_from_mesh_verts | ( | BVHTreeFromMesh * | data, |
DerivedMesh * | mesh, | ||
float | epsilon, | ||
int | tree_type, | ||
int | axis | ||
) |
Definition at line 509 of file bvhutils.c.
References BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), DerivedMesh::bvhCache, bvhcache_find(), bvhcache_insert(), BVHTREE_FROM_VERTICES, BVHTreeFromMesh::cached, CD_MFACE, CD_MVERT, co, KDL::epsilon, BVHTreeFromMesh::face, DerivedMesh::getFaceDataArray, DerivedMesh::getNumVerts, DerivedMesh::getVertDataArray, i, BVHTreeFromMesh::mesh, BVHTreeFromMesh::nearest_callback, NULL, BVHTreeFromMesh::raycast_callback, BVHTreeFromMesh::sphere_radius, BVHTreeFromMesh::tree, TRUE, and BVHTreeFromMesh::vert.
Referenced by get_vert2geom_distance(), shrinkwrap_calc_nearest_vertex(), and shrinkwrap_get_tarmat().
float bvhtree_ray_tri_intersection | ( | const BVHTreeRay * | ray, |
const float | UNUSEDm_dist, | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3] | ||
) |
Definition at line 51 of file bvhutils.c.
References BVHTreeRay::direction, FLT_MAX, isect_ray_tri_epsilon_v3(), NULL, and BVHTreeRay::origin.
void free_bvhtree_from_mesh | ( | struct BVHTreeFromMesh * | data | ) |
Definition at line 712 of file bvhutils.c.
References BLI_bvhtree_free(), BVHTreeFromMesh::cached, and BVHTreeFromMesh::tree.
Referenced by connect_hair(), deformVerts(), dynamicPaint_paintMesh(), followtrack_evaluate(), freeData(), get_vert2geom_distance(), shrinkwrap_calc_nearest_surface_point(), shrinkwrap_calc_nearest_vertex(), shrinkwrap_calc_normal_projection(), and shrinkwrap_get_tarmat().
static void mesh_edges_nearest_point | ( | void * | userdata, |
int | index, | ||
const float | co[3], | ||
BVHTreeNearest * | nearest | ||
) | [static] |
Definition at line 481 of file bvhutils.c.
References closest_to_line_segment_v3(), MVert::co, BVHTreeNearest::co, copy_v3_v3(), data, BVHTreeNearest::dist, BVHTreeFromMesh::edge, BVHTreeNearest::index, len_squared_v3v3(), BVHTreeNearest::no, normalize_v3(), sub_v3_v3v3(), MEdge::v1, MEdge::v2, and BVHTreeFromMesh::vert.
Referenced by bvhtree_from_mesh_edges().
static void mesh_faces_nearest_point | ( | void * | userdata, |
int | index, | ||
const float | co[3], | ||
BVHTreeNearest * | nearest | ||
) | [static] |
Definition at line 406 of file bvhutils.c.
References MVert::co, BVHTreeNearest::co, copy_v3_v3(), data, BVHTreeNearest::dist, BVHTreeFromMesh::face, BVHTreeNearest::index, nearest_point_in_tri_surface(), BVHTreeNearest::no, normal_tri_v3(), NULL, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and BVHTreeFromMesh::vert.
Referenced by bvhtree_from_mesh_faces().
static void mesh_faces_spherecast | ( | void * | userdata, |
int | index, | ||
const BVHTreeRay * | ray, | ||
BVHTreeRayHit * | hit | ||
) | [static] |
Definition at line 442 of file bvhutils.c.
References bvhtree_ray_tri_intersection(), MVert::co, BVHTreeRayHit::co, data, BVHTreeRay::direction, BVHTreeRayHit::dist, BVHTreeFromMesh::face, BVHTreeRayHit::index, madd_v3_v3v3fl(), BVHTreeRayHit::no, normal_tri_v3(), NULL, BVHTreeRay::origin, BVHTreeFromMesh::sphere_radius, sphereray_tri_intersection(), MFace::v1, MFace::v2, MFace::v3, MFace::v4, and BVHTreeFromMesh::vert.
Referenced by bvhtree_from_mesh_faces().
float nearest_point_in_tri_surface | ( | const float | v0[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | p[3], | ||
int * | v, | ||
int * | e, | ||
float | nearest[3] | ||
) |
Definition at line 84 of file bvhutils.c.
References add_v3_v3v3(), C, copy_v3_v3(), KDL::diff(), dot_v3v3(), fabs(), fabsf, mul_v3_fl(), sub_v3_v3v3(), T, and simple_enum_gen::w.
Referenced by mesh_faces_nearest_point(), and mesh_faces_nearest_point_dp().
static float sphereray_tri_intersection | ( | const BVHTreeRay * | ray, |
float | radius, | ||
const float | m_dist, | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3] | ||
) | [static] |
Definition at line 61 of file bvhutils.c.
References BVHTreeRay::direction, FLT_MAX, isect_sweeping_sphere_tri_v3(), madd_v3_v3v3fl(), normal_tri_v3(), and BVHTreeRay::origin.
Referenced by mesh_faces_spherecast().