mailr23470 - /trunk/lib/geometry/lines.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 27, 2014 - 16:30:
Author: bugman
Date: Tue May 27 16:30:56 2014
New Revision: 23470

URL: http://svn.gna.org/viewcvs/relax?rev=23470&view=rev
Log:
Fix for the lib.geometry.lines.closest_point_ax() function for when the two 
points are the same.

If the point on the line and point in the 3D space are the same, then this 
function used to return
an array of NaN values.  This situation is now caught and the point in the 3D 
space is returned.


Modified:
    trunk/lib/geometry/lines.py

Modified: trunk/lib/geometry/lines.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/geometry/lines.py?rev=23470&r1=23469&r2=23470&view=diff
==============================================================================
--- trunk/lib/geometry/lines.py (original)
+++ trunk/lib/geometry/lines.py Tue May 27 16:30:56 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2013 Edward d'Auvergne                                       
 #
+# Copyright (C) 2013-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -66,6 +66,10 @@
     @rtype:             numpy rank-1 array
     """
 
+    # Check if the two points are the same, returning the point to avoid 
NaNs.
+    if norm(line_pt - point) < 1e-6:
+        return point
+
     # The hypotenuse.
     hypo = point - line_pt
     hypo_len = norm(hypo)




Related Messages


Powered by MHonArc, Updated Tue May 27 16:40:02 2014