SwapVertices() private method

private SwapVertices ( int v1, int v2 ) : void
v1 int
v2 int
return void
コード例 #1
0
        static void InvertPolygon(VertexStore myvxs, int start, int end)
        {
            int       i;
            VertexCmd tmp_PathAndFlags = myvxs.GetCommand(start);

            --end; // Make "end" inclusive
            // Shift all commands to one position
            for (i = start; i < end; i++)
            {
                myvxs.ReplaceCommand(i, myvxs.GetCommand(i + 1));
            }
            // Assign starting command to the ending command
            myvxs.ReplaceCommand(end, tmp_PathAndFlags);

            // Reverse the polygon
            while (end > start)
            {
                myvxs.SwapVertices(start++, end--);
            }
        }