Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does a path need to be defined? #17

Open
CharlesLindberghMcGill opened this issue Sep 20, 2019 · 0 comments
Open

How does a path need to be defined? #17

CharlesLindberghMcGill opened this issue Sep 20, 2019 · 0 comments

Comments

@CharlesLindberghMcGill
Copy link

CharlesLindberghMcGill commented Sep 20, 2019

I'm unable to ever manually define a path without the use of a convex algorithm. I'm not sure what is wrong with my polygon - I tried doing it counter clockwise as well.

No error seems to be thrown either - it just freezes up and is stuck in the "Triangulate" function inside of the "Triangulator.cs."

// tl to tr
            for(var i = meshX; i<meshX + meshW; i++)
                add(i, meshY);

            // tr to br
            for(var j = meshY; j<meshY + meshH; j++)
                add(meshX + meshW, j);

            // br to bl
            for(var i = meshX + meshW; i>meshX; i--)
                add(i, meshY + meshH);

            // bl to tr
            for(var j = meshY + meshH; j>meshY; j--)
                add(meshX, j);

As for the draw code it's nothing complicated.

 drawBatch.FillPath(
                brush,
                ShapePoints
            );

The code provided essentially builds a rectangle. It creates a path by going from the top left of the rectangle to the top right, then the top right to the bottom right, then the bottom right to the bottom left, and last but not least from the bottom left to the top left.

The rectangle is actually made up of points that are tiles, so the add function tranforms "x1, y0" to "x32, y0". This list is "distinct" -- i.e no points overlap or are the same - preventing potentially creating a non regular or overlapping polygon shape.

Any help would be much appreciated!

With kind regards,

  • Chuck McGill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant