[Bf-blender-cvs] [a7d8f60] master: Py/API: Improve intersect_line_line with parallel lines

Campbell Barton noreply at git.blender.org
Mon Jul 21 15:23:03 CEST 2014


Commit: a7d8f602a6f60a0c117615c0493315e4de9dd9e2
Author: Campbell Barton
Date:   Mon Jul 21 23:13:21 2014 +1000
Branches: master
https://developer.blender.org/rBa7d8f602a6f60a0c117615c0493315e4de9dd9e2

Py/API: Improve intersect_line_line with parallel lines

Now comparing the distance between line-intersection points
to see how close lines are - doesn't fail in the parallel case.

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

M	source/blender/python/mathutils/mathutils_geometry.c

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

diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index b289f73..20d69ca 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -229,6 +229,11 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
 		}
 
 		result = isect_line_line_v3(v1, v2, v3, v4, i1, i2);
+		/* The return-code isnt exposed,
+		 * this way we can check know how close the lines are. */
+		if (result == 1) {
+			closest_to_line_v3(i2, i1, v3, v4);
+		}
 
 		if (result == 0) {
 			/* colinear */




More information about the Bf-blender-cvs mailing list