std::auto_ptr<QuadEdge> QuadEdge::makeEdge(const Vertex &o, const Vertex &d) { QuadEdge *q0 = new QuadEdge(); //q1-q3 are free()'d by q0 QuadEdge *q1 = new QuadEdge(); QuadEdge *q2 = new QuadEdge(); QuadEdge *q3 = new QuadEdge(); q0->_rot = q1; q1->_rot = q2; q2->_rot = q3; q3->_rot = q0; q0->setNext(q0); q1->setNext(q3); q2->setNext(q2); q3->setNext(q1); QuadEdge *base = q0; base->setOrig(o); base->setDest(d); return std::auto_ptr<QuadEdge>(base); }
void QuadEdge::swap(QuadEdge &e) { QuadEdge &a = e.oPrev(); QuadEdge &b = e.sym().oPrev(); splice(e, a); splice(e.sym(), b); splice(e, a.lNext()); splice(e.sym(), b.lNext()); e.setOrig(a.dest()); e.setDest(b.dest()); }