/** * Create a new edge (i.e. a segment) * * @param orig origin of the segment * @param dest end of the segment * @return the QuadEdge of the origin point */ public static QuadEdge makeEdge(Point orig, Point dest) { QuadEdge q0 = new QuadEdge(null, null, orig); QuadEdge q1 = new QuadEdge(null, null, null); QuadEdge q2 = new QuadEdge(null, null, dest); QuadEdge q3 = new QuadEdge(null, null, null); // create the segment q0.onext = q0; q2.onext = q2; // lonely segment: no "next" quadedge q1.onext = q3; q3.onext = q1; // in the dual: 2 communicating facets // dual switch q0.rot = q1; q1.rot = q2; q2.rot = q3; q3.rot = q0; return q0; }
/** * attach/detach the two edges = combine/split the two rings in the dual space * * @param q1,q2 the 2 QuadEdge to attach/detach */ public static void splice(QuadEdge a, QuadEdge b) { QuadEdge alpha = a.onext().rot(); QuadEdge beta = b.onext().rot(); QuadEdge t1 = b.onext(); QuadEdge t2 = a.onext(); QuadEdge t3 = beta.onext(); QuadEdge t4 = alpha.onext(); a.setOnext(t1); b.setOnext(t2); alpha.setOnext(t3); beta.setOnext(t4); }
/** @return the previous QuadEdge (pointing to this.orig) */ public QuadEdge oprev() { return rot.onext().rot(); }