def arc_insert(self, p): if self.arc is None: self.arc = Arc(p) else: # find the current arcs at p.y i = self.arc while i is not None: flag, z = self.intersect(p, i) if flag: # new parabola intersects arc i flag, zz = self.intersect(p, i.pnext) if (i.pnext is not None) and (not flag): i.pnext.pprev = Arc(i.p, i, i.pnext) i.pnext = i.pnext.pprev else: i.pnext = Arc(i.p, i) i.pnext.s1 = i.s1 # add p between i and i.pnext i.pnext.pprev = Arc(p, i, i.pnext) i.pnext = i.pnext.pprev i = i.pnext # now i points to the new arc # add new half-edges connected to i's endpoints seg = Segment(z) self.output.append(seg) i.pprev.s1 = i.s0 = seg seg = Segment(z) self.output.append(seg) i.pnext.s0 = i.s1 = seg # check for new circle events around the new arc self.check_circle_event(i, p.x) self.check_circle_event(i.pprev, p.x) self.check_circle_event(i.pnext, p.x) return i = i.pnext # if p never intersects an arc, append it to the list i = self.arc while i.pnext is not None: i = i.pnext i.pnext = Arc(p, i) # insert new segment between p and i x = self.x0 y = (i.pnext.p.y + i.p.y) / 2.0; start = Point(x, y) seg = Segment(start) i.s1 = i.pnext.s0 = seg self.output.append(seg)
def process_event(self): # get next event from circle pq e = self.event.pop() if e.valid: # start new edge s = Segment(e.p) self.output.append(s) # remove associated arc (parabola) a = e.a if a.pprev is not None: a.pprev.pnext = a.pnext a.pprev.s1 = s if a.pnext is not None: a.pnext.pprev = a.pprev a.pnext.s0 = s # finish the edges before and after a if a.s0 is not None: a.s0.finish(e.p) if a.s1 is not None: a.s1.finish(e.p) # recheck circle events on either side of p if a.pprev is not None: self.check_circle_event(a.pprev, e.x) if a.pnext is not None: self.check_circle_event(a.pnext, e.x)
def process_event(self): #NAMES!!! WHAT THE HELL DO THEY MEAN!!! # get next event from circle pq event = self.event.pop() #e? Thats an event if event.valid: # start new edge circleCenter = Segment(event.point) self.output.append(circleCenter)