public void Polygonize(IImplicitField2D field) { m_field = field; ResetCells(); // reset bTouched flags m_cellStack.Clear(); // iterate over seed points for (int i = 0; i < m_seedPoints.Count; ++i) { SeedPoint p = (SeedPoint)m_seedPoints[i]; int xi = (int)(p.x / m_fCellSize); int yi = (int)(p.y / m_fCellSize); bool bFoundSurface = false; while (!bFoundSurface && yi > 0 && yi < m_cells.Length - 1 && xi > 0 && xi < m_cells[0].Length - 1) { if (m_cells[yi][xi].bTouched == false) { bool bResult = ProcessCell(xi, yi); if (bResult == true) { bFoundSurface = true; } } else { bFoundSurface = true; } xi--; } while (m_cellStack.Count != 0) { Cell cell = (Cell)m_cellStack[m_cellStack.Count - 1]; m_cellStack.RemoveAt(m_cellStack.Count - 1); if (m_cells[(int)cell.y][(int)cell.x].bTouched == false) { bool bResult = ProcessCell((int)cell.x, (int)cell.y); if (bResult == false) { bResult = true; } } } } }
public void AddChild(IImplicitField2D pField) { m_vChildren.Add(pField); }