diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-29 14:14:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-29 14:22:28 +0300 |
commit | ba32d9d4cd2ad256722a4405d2b1909ec8d4d811 (patch) | |
tree | bf359b799a7e28ddc5f14cff2279a6eed946fdc2 | |
parent | 8e9534a850e593e7cd7bbb35c4326bb69eb5b58c (diff) |
Expose bvhtree_sphereray_tri_intersection for general use
-rw-r--r-- | source/blender/blenkernel/BKE_bvhutils.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/bvhutils.c | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h index d8eaa350e66..18eda63bcf1 100644 --- a/source/blender/blenkernel/BKE_bvhutils.h +++ b/source/blender/blenkernel/BKE_bvhutils.h @@ -125,6 +125,9 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data); float bvhtree_ray_tri_intersection( const BVHTreeRay *ray, const float m_dist, const float v0[3], const float v1[3], const float v2[3]); +float bvhtree_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_squared( const float v0[3], const float v1[3], const float v2[3], const float p[3], int *v, int *e, float nearest[3]); diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index a7a9dc11fab..6131153480e 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -66,7 +66,7 @@ float bvhtree_ray_tri_intersection( return FLT_MAX; } -static float sphereray_tri_intersection( +float bvhtree_sphereray_tri_intersection( const BVHTreeRay *ray, float radius, const float m_dist, const float v0[3], const float v1[3], const float v2[3]) { @@ -194,7 +194,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r if (data->sphere_radius == 0.0f) dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2); else - dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2); + dist = bvhtree_sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2); if (dist >= 0 && dist < hit->dist) { hit->index = index; @@ -229,7 +229,7 @@ static void mesh_looptri_spherecast(void *userdata, int index, const BVHTreeRay if (data->sphere_radius == 0.0f) dist = bvhtree_ray_tri_intersection(ray, hit->dist, UNPACK3(vtri_co)); else - dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, UNPACK3(vtri_co)); + dist = bvhtree_sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, UNPACK3(vtri_co)); if (dist >= 0 && dist < hit->dist) { hit->index = index; @@ -257,7 +257,7 @@ static void editmesh_faces_spherecast(void *userdata, int index, const BVHTreeRa if (data->sphere_radius == 0.0f) dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2); else - dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2); + dist = bvhtree_sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2); if (dist >= 0 && dist < hit->dist) { hit->index = index; |