public HalfEdge CreateEdge(Node aNode, Node bNode, bool isDirected = false) { // if (aNode.Edge != null && bNode.Edge != null) // throw new Exception(); var edgeAB = new HalfEdge(this); var edgeBA = new HalfEdge(this); var edge = new Edge(this); var edgePolygon = CreatePolygon(edgeAB); edgeAB.SetOrigin(aNode); edgeBA.SetOrigin(bNode); edgeAB.SetNext(edgeBA); edgeAB.SetPrevious(edgeBA); edgeAB.SetTwin(edgeBA); edgeAB.SetPolygon(edgePolygon); edgeBA.SetPolygon(edgePolygon); if (isDirected) { edgeBA.SetActive(false); } edge.SetPair(edgeAB); Edges.Add(edge); HalfEdges.Add(edgeAB); HalfEdges.Add(edgeBA); return(edgeAB); }