// For time visualisation - each step is added to the timelapse
        void AddCurrentFrameToHistory(WaveCollapseHistory timelapse)
        {
            var timeFrameToPoints    = OutputObservations();
            var timeFrameUncollapsed = wave.GetPossibleTileTypes();
            var patternOccurence     = wave.GetCollapsedPatternsCounts();

            var timeFrameElement = new WaveCollapseHistoryElement(timeFrameToPoints.Item1,
                                                                  timeFrameToPoints.Item2, timeFrameToPoints.Item3, wave.superpositions, timeFrameUncollapsed, patternOccurence,
                                                                  wave.entropies);

            timelapse.AddTimeFrame(timeFrameElement);
        }
Ejemplo n.º 2
0
        public static float CountSuccessfullCellsInImageArea(double[,] image, WaveCollapseHistoryElement wfc)
        {
            int numberOfImageCellsInImage = 0;
            int numberOfNotWhiteCells     = 0;

            for (int i = 0; i < wfc.Superpositions.GetLength(0); i++)
            {
                for (int j = 0; j < wfc.Superpositions.GetLength(1); j++)
                {
                    if (image[i, j] < 0.5)
                    {
                        numberOfImageCellsInImage++;

                        var cellState = wfc.Superpositions[i, j].state;
                        if (cellState != State.EMPTY)
                        {
                            numberOfNotWhiteCells++;
                        }
                    }
                }
            }

            return(numberOfNotWhiteCells / (numberOfImageCellsInImage * 1.0f));
        }
Ejemplo n.º 3
0
 public void AddToList(WaveCollapseHistoryElement element)
 {
     _elements.Add(element);
 }
Ejemplo n.º 4
0
 public void AddTimeFrame(WaveCollapseHistoryElement element)
 {
     _elements.Add(element);
 }