Ejemplo n.º 1
0
    private void ConvertTriangulationToVoronoi()
    {
        // check if there are invalid triangles
        int invalids = triangulation.CountInvalidTriangles(points, true);  // findFirst=true

        if (invalids > 0)
        {
            Debug.LogError("Found invalid triangles; triangulation is faulty.");
        }

        voronoi = new Voronoi(max_x, max_z);
        if (invalids == 0)
        {
            voronoi.ComputeVoronoi(triangulation.triangles, points);
        }
    }
    void ConvertTriangulationToVoronoi()
    {
        // check if there are invalid triangles
        int invalids = CountInvalidTriangles(triangles, points, true);  // findFirst=true

        if (invalids > 0)
        {
            Debug.LogError("Found invalid triangles; triangulation is faulty.");
        }

        voronoi = new Voronoi(max_x, max_z);
        if (invalids == 0)
        {
            voronoi.ComputeVoronoi(triangles, points);
            voronoi.Cleanup(onlyUseVoronoiWithinBoundaries, removeOpenVoronoiCells, removeLonerVoronoiCells);
        }
    }