//Remove redundant quads to reduce total count public static int RemoveRedundantQuads(QuadList quads) { int removedCount = 0; for (int me = 0; me < quads.Count; me++) { for (int you = me; you < quads.Count; you++) { if (me != you) { Quad meQuad = quads.GetQuad(me); Quad youQuad = quads.GetQuad(you); //I saw a duplicate if ((meQuad.Pt1.IsEqualTo(youQuad.Pt1)) && (meQuad.Pt2.IsEqualTo(youQuad.Pt2))) { //we have a redundancy removedCount++; quads.RemoveQuad(youQuad); } } } } return(removedCount); }
//True if same public bool IsEqualTo(QuadList quads) { if (quads == null || quads.Count != Count) { return(false); } for (int i = 0; i < Count; i++) { Quad quad1 = quads.GetQuad(i); Quad quad2 = Quads[i]; if (quad1.IsEqualTo(quad2) == false) { return(false); } } return(true); }