GetPatterns() 공개 정적인 메소드

public static GetPatterns ( ITopoArray sample, int nx, int ny, int nz, bool periodicX, bool periodicY, bool periodicZ, Dictionary patternIndices, List patternArrays, List frequencies ) : void
sample ITopoArray
nx int
ny int
nz int
periodicX bool
periodicY bool
periodicZ bool
patternIndices Dictionary
patternArrays List
frequencies List
리턴 void
예제 #1
0
        public void AddSample(ITopoArray <Tile> sample, TileRotation tileRotation = null)
        {
            if (sample.Topology.Depth == 1)
            {
                nz = 1;
            }

            var topology = sample.Topology.AsGridTopology();

            var periodicX = topology.PeriodicX;
            var periodicY = topology.PeriodicY;
            var periodicZ = topology.PeriodicZ;

            foreach (var s in OverlappingAnalysis.GetRotatedSamples(sample, tileRotation))
            {
                OverlappingAnalysis.GetPatterns(s, nx, ny, nz, periodicX, periodicY, periodicZ, patternIndices, patternArrays, frequencies);
            }

            // Update the model based on the collected data
            var directions = topology.Directions;

            // TODO: Don't regenerate this from scratch every time
            propagator = new List <HashSet <int>[]>(patternArrays.Count);
            for (var p = 0; p < patternArrays.Count; p++)
            {
                propagator.Add(new HashSet <int> [directions.Count]);
                for (var d = 0; d < directions.Count; d++)
                {
                    var l = new HashSet <int>();
                    for (var p2 = 0; p2 < patternArrays.Count; p2++)
                    {
                        var dx = directions.DX[d];
                        var dy = directions.DY[d];
                        var dz = directions.DZ[d];
                        if (Aggrees(patternArrays[p], patternArrays[p2], dx, dy, dz))
                        {
                            l.Add(p2);
                        }
                    }
                    propagator[p][d] = l;
                }
            }

            patternsToTiles = patternArrays
                              .Select((x, i) => new KeyValuePair <int, Tile>(i, x.Values[0, 0, 0]))
                              .ToDictionary(x => x.Key, x => x.Value);

            tilesToPatterns = patternsToTiles.ToLookup(x => x.Value, x => x.Key);
        }
예제 #2
0
        public void AddSample(ITopoArray <Tile> sample, TileRotation tileRotation = null)
        {
            if (sample.Topology.Depth == 1)
            {
                nz = 1;
            }

            var topology = sample.Topology.AsGridTopology();

            var periodicX = topology.PeriodicX;
            var periodicY = topology.PeriodicY;
            var periodicZ = topology.PeriodicZ;

            foreach (var s in OverlappingAnalysis.GetRotatedSamples(sample, tileRotation))
            {
                OverlappingAnalysis.GetPatterns(s, nx, ny, nz, periodicX, periodicY, periodicZ, patternIndices, patternArrays, frequencies);
            }

            sampleTopologyDirections = topology.Directions;
            propagator = null;// Mark as dirty
        }