def determine_enclosure_centre_side(points, line): cpoints = list(points) while len(cpoints) > 3: rejected = find_constrained_redundant_points(cpoints, line) if not rejected: scroll_points_list(cpoints) rejected = find_constrained_redundant_points(cpoints, line) if not rejected: assert False for p in cpoints: if p in rejected: cpoints.remove(p) print "Number of points before direct search: ", len(cpoints) circle, pivots = find_constrained_centre_directly(cpoints, line) middle = pivots[0].sum(pivots[-1]).multiply(0.5) return line.define_point_side(middle)
def internal_compare(self, lst, line): circle, points = find_constrained_centre_directly(lst, line) while len(lst) > 3: rejected = find_constrained_redundant_points(lst, line) if not rejected: chk1 = len(lst) last = lst[-1] lst.remove(last) lst.insert(0, last) chk2 = len(lst) assert chk1 == chk2 rejected = find_constrained_redundant_points(lst, line) if not rejected: print "bad bad bad" for p in lst: if p in rejected: lst.remove(p) for p in points: self.assertTrue(p in lst)