[Bf-blender-cvs] [6ddacfa] bmesh-boolean-experiment: Use watertight intersection test

Campbell Barton noreply at git.blender.org
Tue Oct 27 18:52:33 CET 2015


Commit: 6ddacfac6017d2413654489cf2d2bbe1a528b823
Author: Campbell Barton
Date:   Wed Oct 28 04:44:35 2015 +1100
Branches: bmesh-boolean-experiment
https://developer.blender.org/rB6ddacfac6017d2413654489cf2d2bbe1a528b823

Use watertight intersection test

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

M	source/blender/bmesh/tools/bmesh_intersect.c

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

diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c
index 969cda5..f57b0a6 100644
--- a/source/blender/bmesh/tools/bmesh_intersect.c
+++ b/source/blender/bmesh/tools/bmesh_intersect.c
@@ -835,6 +835,10 @@ BLI_INLINE void raycast_append_depth(RaycastData *raycast_data, float depth)
 	BLI_buffer_append(&raycast_data->z_buffer, float, depth);
 }
 
+#ifdef USE_KDOPBVH_WATERTIGHT
+static const struct IsectRayPrecalc isect_precalc_x = {1, 2, 0, 0, 0, 1};
+#endif
+
 static void raycast_callback(void *userdata,
                              int index,
                              const BVHTreeRay *ray,
@@ -847,11 +851,12 @@ static void raycast_callback(void *userdata,
 	const float *v2 = looptris[index][2]->v->co;
 	float dist, uv[2];
 	(void) hit;  /* Ignored. */
-	if (isect_ray_tri_epsilon_v3(ray->origin, ray->direction,
-	                             v0, v1, v2,
-	                             &dist,
-	                             uv,
-	                             FLT_EPSILON))
+	if (
+#ifdef USE_KDOPBVH_WATERTIGHT
+	    isect_ray_tri_watertight_v3(ray->origin, &isect_precalc_x, v0, v1, v2, &dist, uv))
+#else
+	    isect_ray_tri_epsilon_v3(ray->origin, ray->direction, v0, v1, v2, &dist, uv, FLT_EPSILON))
+#endif
 	{
 		if (dist >= 0.0f && !raycast_has_depth(raycast_data, dist)) {
 #ifdef USE_DUMP




More information about the Bf-blender-cvs mailing list