Expose bvhtree_sphereray_tri_intersection for general use
authorCampbell Barton <ideasman42@gmail.com>
Wed, 29 Jul 2015 11:14:16 +0000 (21:14 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 29 Jul 2015 11:22:28 +0000 (21:22 +1000)
source/blender/blenkernel/BKE_bvhutils.h
source/blender/blenkernel/intern/bvhutils.c

index d8eaa350e663b7f4fe5991634108ead0219c3f47..18eda63bcf1dea4a8ecbe8a67b7ee8b5eee830c0 100644 (file)
@@ -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]);
index a7a9dc11fabdd676c2b0fecc6b9e3bd3cd1ae3f7..6131153480e35a039275e34880e51c2684c5a2bd 100644 (file)
@@ -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;