(* PROCEDURE MakeAdjacentVertex(c,d: Corner; e: Corner) RAISES {ValidationError} = BEGIN IF IsIsolatedVertex(e) OR IsFaceWithNoBoundary(e) THEN RAISE ValidationError("In InsertAdjacentVertex: the corner to be split MUST be an edge") ELSE c.oSplice(d); WITH be = e.borderOf(), es = e.cSym(), bes = es.borderOf() DO be.insertCorner(c); bes.insertCorner(d); IF IsRing(e) THEN c.bLink(NIL,c); d.bLink(NIL,d); be.removeCorner(e); bes.removeCorner(es) ELSE c.bLink(e,e.bNext()); d.bLink(es,es.bNext()) END END END END MakeAdjacentVertex; PROCEDURE Connect(c,d,nc,nd: Corner) : Face RAISES {ValidationError} = BEGIN WITH bc = c.borderOf(), bd = d.borderOf(), f = bc.faceOf() DO IF bd.faceOf() # f THEN RAISE ValidationError("In connect, the two corners MUST be adjacent to a same face") ELSE IF AreSameCorner(c,d) THEN (* creates a loop *) IF IsIsolatedVertex(d) THEN nc.oSplice(nd); nc.bLink(NIL,nc); nd.bLink(NIL,nd); bd.removeCorner(d) (* removing isolated vertex => removing border *) ELSE nc.oSplice(c); nd.oSplice(nc); nc.bLink(NIL,nc); nd.bLink(c.bPrev(),c); f.removeBorder(bc); END; WITH fnc = CreateFace(), bnc = NEW(SMCorner.Border).init(nc), fnd = CreateFace(), bnd = NEW(SMCorner.Border).init(nd) DO fnc.insertBorder(bnc); fnd.insertBorder(bnd) END ELSE nc.oSplice(c); nd.oSplice(d); nc.bLink(c.bPrev(),d); nd.bLink(d.bPrev(),c); IF AreInSameBorder(c,d) THEN f.removeBorder(bc); WITH fnc = CreateFace(), bnc = NEW(SMCorner.Border).init(nc), fnd = CreateFace(), bnd = NEW(SMCorner.Border).init(nd) DO fnc.insertBorder(bnc); fnd.insertBorder(bnd) END; ELSE f.removeBorder(bc); f.removeBorder(bd); WITH fnc = CreateFace() DO fnc.insertBorder(bc); fnc.insertBorder(bd); WITH bc_bd = fnc.joinBorders(bc,bd) DO bc_bd.insertCorner(nc); bc_bd.insertCorner(nd); END END END END; RETURN f END END END Connect; PROCEDURE Disconnect(c: Corner) *)