def test_mindistance_segment2track(): print 'touching one segment only' print cll.mindistance_segment2track([1,0,0],[0,1,0],np.array([[1,0,0],[0,1,1],[3,3,3]])) print 'cross with the second' print cll.mindistance_segment2track([0,0,0],[1,0,0],np.array([[3,3,3],[0.5,1,0],[0.5,-1,0]]))
def test_mindistance_segment2track(): print 'touching one segment only' print cll.mindistance_segment2track([1, 0, 0], [0, 1, 0], np.array([[1, 0, 0], [0, 1, 1], [3, 3, 3]])) print 'cross with the second' print cll.mindistance_segment2track([0, 0, 0], [1, 0, 0], np.array([[3, 3, 3], [0.5, 1, 0], [0.5, -1, 0]]))
def process_picking(self,near,far): print('process picking') min_dist=[cll.mindistance_segment2track(near,far,xyz) for xyz in self.data] min_dist=np.array(min_dist) #print min_dist self.picked_track=min_dist.argmin() print 'min index',self.picked_track min_dist_info=[cll.mindistance_segment2track_info(near,far,xyz) for xyz in self.data] A = np.array(min_dist_info) dist=10**(-3) iA=np.where(A[:,0]<dist) minA=A[iA] print 'minA ', minA miniA=minA[:,1].argmin() print 'final min index ',iA[0][miniA] self.picked_track=iA[0][miniA]
def process_picking(self,near,far): print('process picking') min_dist=[cll.mindistance_segment2track(near,far,xyz) for xyz in self.data] min_dist=np.array(min_dist) #print min_dist self.picked_track=min_dist.argmin() print self.picked_track