//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Validates the WingedEdge structure in several ways. </summary> /// <remarks> Darrellp, 2/18/2011. </remarks> /// <returns> true if the winged edge structure is valid. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public bool Validate() { // Each edge has two vertices associated with it so we can have at most twice as many // vertices as edges... if (LstVertices.Count > 2 * LstEdges.Count) { return(Failure()); } // Validate the edges one by one if (LstEdges.Any(edge => !edge.Validate())) { return(Failure()); } // Validate the polygons one by one if (LstPolygons.Any(poly => !poly.FValidateEdgesInOrder())) { return(Failure()); } return(true); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Adds a polygon. </summary> /// <remarks> Darrellp, 2/18/2011. </remarks> /// <param name="polygon"> The polygon to be added. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// public void AddPoly(TPoly polygon) { LstPolygons.Add(polygon); }