Example #1
0
File: T.py Project: ideasman42/lsi
 def compare_to_key(self, p):
     x0 = self.value[0][0]
     y0 = self.value[0][1]
     y1 = p[1]
     if self.m != 0 and self.m is not None:
         x1 = x0 - float(y0-y1)/self.m
         return helper.compare_by_x(p, (x1, y1))
     else:
         x1 = p[0]
         return 0
Example #2
0
File: T.py Project: ideasman42/lsi
 def contain_p(self, p, lists):
     c = self.compare_to_key(p)
     if c == 0:
         if self.left is None and self.right is None:
             if helper.compare_by_x(p, self.value[1]) == 0:
                 lists[1].append(self.value)
             else:
                 lists[0].append(self.value)
         if self.left:
             self.left.contain_p(p, lists)
         if self.right:
             self.right.contain_p(p, lists)
     elif c < 0:
         if self.left:
             self.left.contain_p(p, lists)
     else:
         if self.right:
             self.right.contain_p(p, lists)