private SwapVertices ( int v1, int v2 ) : void | ||
v1 | int | |
v2 | int | |
return | void |
internal void SwapVertices(int v1, int v2)
{
double x_tmp = m_coord_xy[v1 << 1];
double y_tmp = m_coord_xy[(v1 << 1) + 1];
m_coord_xy[v1 << 1] = m_coord_xy[v2 << 1];//x
m_coord_xy[(v1 << 1) + 1] = m_coord_xy[(v2 << 1) + 1];//y
m_coord_xy[v2 << 1] = x_tmp;
m_coord_xy[(v2 << 1) + 1] = y_tmp;
byte cmd = m_cmds[v1];
m_cmds[v1] = m_cmds[v2];
m_cmds[v2] = cmd;
}
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--); } }