Skip to content

Splitting polygons with vertices that touch its edges #912

Answered by nicophilippi
nicophilippi asked this question in Q&A
Discussion options

You must be logged in to vote

@AngusJohnson @aismann Have a solution now. I need to test it a little more to be sure it doesn't cause issues, but so far it seems promising. If I ever update and improve the code, I will update the message here accordingly.

/// <summary>Splits the contours of the polygon on single vertex connections and saves newly
/// created contours in polygon</summary>
public static void SplitSingleVertexConnected(this Paths64 polygon)
{
    polygon.InsertVertexAtIntersects();

    for (var contourI = 0; contourI < polygon.Count; contourI++)
    {
        for (var vertex1I = 0; vertex1I < polygon[contourI].Count; vertex1I++)
        {
            for (var vertex2I = 0; vertex2I < polygon[contourI].C…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@aismann
Comment options

@nicophilippi
Comment options

@AngusJohnson
Comment options

@nicophilippi
Comment options

Answer selected by nicophilippi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants