Skip to content

How does a path need to be defined? #17

@CharlesLindberghMcGill

Description

@CharlesLindberghMcGill

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions