def process_case3(self, angle): l1 = Edge.length(self.curr_polygon.next(), self.curr_polygon.curr_point) l2 = Edge.length(self.curr_polygon.curr_point, self.curr_polygon.prev()) p2 = self.curr_polygon.curr_point p1 = self.curr_polygon.prev() a = l2 index = self.curr_polygon.curr_index if l1 < l2: p1 = self.curr_polygon.curr_point p2 = self.curr_polygon.next() a = l1 index += 1 p_middle = Point.new((p1.x + p2.x) / 2.0, (p1.y + p2.y) / 2.0) m = 2.0 * (p2.x - p1.x) n = 2.0 * (p2.y - p1.y) k = ((p2.x ** 2) + (p2.y ** 2)) - ((p1.x ** 2) + (p1.y ** 2)) p = p2.y - p1.y q = p1.x - p2.x l = p1.x * p2.y - p2.x * p1.y + Math.sqrt(3.0) * a * a / 2.0 det = n * p - q * m x_new = (l * n - k * q) / det y_new = (k * p - l * m) / det p = Point.new(x_new, y_new) if self.curr_polygon.has_point(p): return [p, index] # find symmetric point p_new = Point(2.0 * p.x - p_middle.x, 2.0 * p.y - p_middle.y) if p_new in self.curr_polygon: return [p_new, index] raise RuntimeError("doh doh doh 3")