public void Validate() { for (int i = 0; i < cellList.Count; i++) { for (int j = 0; j < cellList.Count; j++) { if (j != i) { if (cellList[i] == cellList[j]) { Debug.LogError("Duplicate cell (class)"); return; } if (cellList[i].position == cellList[j].position) { Debug.LogError("Duplicate cell (position)"); return; } if (cellList[i].node == cellList[j].node) { Debug.LogError("Duplicate cell (node)"); return; } } } } for (int k = 0; k < cornerList.Count; k++) { for (int l = 0; l < cornerList.Count; l++) { if (l != k) { if (cornerList[k] == cornerList[l]) { Debug.LogError("Duplicate corner (class)"); return; } if (cornerList[k].position == cornerList[l].position) { Debug.LogError("Duplicate corner (position)"); return; } if (cornerList[k].node == cornerList[l].node) { Debug.LogError("Duplicate corner (node)"); return; } } } } for (int m = 0; m < edgeList.Count; m++) { for (int n = 0; n < edgeList.Count; n++) { if (n != m) { Edge edge = edgeList[m]; Edge edge2 = edgeList[n]; if (edge == edge2) { Debug.LogError("Duplicate edge (class)"); return; } if (edge.arc == edge2.arc) { Debug.LogError("Duplicate EDGE [" + edge.arc + "] & [" + edge2.arc + "] - (ARC) [" + edge.site0.node.Id + "] & [" + edge.site1.node.Id + "]"); return; } if (edge.corner0 == edge2.corner0 && edge.corner1 == edge2.corner1) { Debug.LogError("Duplicate edge (corner same order)"); return; } if (edge.corner0 == edge2.corner1 && edge.corner1 == edge2.corner0) { Debug.LogError("Duplicate edge (corner different order)"); return; } if (edge.site0 != edge.site1 && edge2.site0 != edge2.site1) { if (edge.site0 == edge2.site0 && edge.site1 == edge2.site1) { Debug.LogError("Duplicate edge (site same order)"); return; } if (edge.site0 == edge2.site1 && edge.site1 == edge2.site0) { Debug.LogError("Duplicate Edge [" + edge.arc.Id + "] -> [" + edge.corner0.node.Id + "<-->" + edge.corner1.node.Id + "] sites: [" + edge.site0.node.Id + " -- " + edge.site1.node.Id + "] and [" + edge2.arc.Id + "] -> [" + edge2.corner0.node.Id + "<-->" + edge2.corner1.node.Id + "] sites: [" + edge2.site0.node.Id + " -- " + edge2.site1.node.Id + "] - (site differnt order)"); Debug.Log("CE 0: " + edge.corner0.position + " 1: " + edge.corner1.position); Debug.Log("OE 0: " + edge2.corner0.position + " 1: " + edge2.corner1.position); Debug.Log("Sites C 0: " + edge.site0.position + " 1: " + edge.site1.position); DebugExtension.DebugCircle2d(edge.site0.position, Color.red, 1f, 15f, true, 4f); DebugExtension.DebugCircle2d(edge.site1.position, Color.magenta, 2f, 15f, true, 4f); Debug.Log("Sites O 0: " + edge2.site0.position + " 1: " + edge2.site1.position); DebugExtension.DebugCircle2d(edge2.site0.position, Color.green, 3f, 15f, true, 4f); DebugExtension.DebugCircle2d(edge2.site1.position, Color.cyan, 4f, 15f, true, 4f); } else { if (edge.site0.node == edge2.site0.node && edge.site1.node == edge2.site1.node) { Debug.LogError("Duplicate edge (site node same order)"); return; } if (edge.site1.node == edge2.site0.node && edge.site0.node == edge2.site1.node) { Debug.LogError("Duplicate edge (site node differnt order)"); return; } } } } } } }
public void Remove(Edge n) { n.site0.Remove(n); n.site1.Remove(n); edges.Remove(n); }