/// <summary> /// Build the splits for the polygon /// </summary> /// <param name="polygon">the polygon</param> /// <returns>the splits</returns> public static IEnumerable <Tuple <int, int> > BuildSplits(Polygon polygon) { var splitter = new ScanSplitByTrapezoidation(polygon); splitter.BuildSplits(-1); return(splitter.splits); }
/// <summary> /// Run n steps and return the edges after that step /// </summary> /// <param name="polygon">the polygon</param> /// <param name="depth">the number of steps to run</param> /// <returns>The edges sorted from High to Low</returns> internal static IEnumerable <string> GetEdgesAfterPartialTrapezoidation(Polygon polygon, int depth) { var splitter = new ScanSplitByTrapezoidation(polygon); splitter.BuildSplits(depth); return(splitter.activeEdges.Edges.Reverse().Select(x => x.ToString())); }
/// <summary> /// Finally, build the triangles /// </summary> /// <param name="collector">the triangle collector</param> public void BuildTriangles(ITriangleCollector collector) { var splits = ScanSplitByTrapezoidation.BuildSplits(this.polygon); var polygonWithMonotones = Polygon.Split(this.polygon, splits, collector); foreach (var subPolygonId in polygonWithMonotones.SubPolygonIds) { var triangluator = new MonotonePolygonTriangulator(polygonWithMonotones, subPolygonId); triangluator.Build(collector); } }
/// <summary> /// Get the possible splits for the polygon /// </summary> /// <returns>the splits</returns> internal IEnumerable <Tuple <int, int> > GetSplits() { return(ScanSplitByTrapezoidation.BuildSplits(this.polygon)); }
/// <summary> /// Iterates over the first n vertices and reports the active edges and the sort order after that step. /// </summary> /// <returns>sorted active edges</returns> internal IEnumerable <string> GetEdgesAfterPartialTrapezoidation(int depth) { return(ScanSplitByTrapezoidation.GetEdgesAfterPartialTrapezoidation(this.polygon, depth)); }