[Bf-blender-cvs] [ba32d9d] master: Expose bvhtree_sphereray_tri_intersection for general use

Campbell Barton noreply at git.blender.org
Wed Jul 29 13:29:15 CEST 2015


Commit: ba32d9d4cd2ad256722a4405d2b1909ec8d4d811
Author: Campbell Barton
Date:   Wed Jul 29 21:14:16 2015 +1000
Branches: master
https://developer.blender.org/rBba32d9d4cd2ad256722a4405d2b1909ec8d4d811

Expose bvhtree_sphereray_tri_intersection for general use

===================================================================

M	source/blender/blenkernel/BKE_bvhutils.h
M	source/blender/blenkernel/intern/bvhutils.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h
index d8eaa35..18eda63 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 a7a9dc1..6131153 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;




More information about the Bf-blender-cvs mailing list