Ejemplo n.º 1
0
        public TileModel GetModel(DirectionSet directions, ITopoArray <Tile>[] samples, TileRotation tileRotation)
        {
            var       modelConfig = Config.Model ?? new Adjacent();
            TileModel tileModel;

            if (modelConfig is Overlapping overlapping)
            {
                var model = new OverlappingModel(overlapping.NX, overlapping.NY, overlapping.NZ);
                foreach (var sample in samples)
                {
                    model.AddSample(sample, tileRotation);
                }
                tileModel = model;
            }
            else if (modelConfig is Adjacent adjacent)
            {
                var model = new AdjacentModel(directions);
                foreach (var sample in samples)
                {
                    model.AddSample(sample, tileRotation);
                }
                tileModel = model;
            }
            else
            {
                throw new ConfigurationException($"Unrecognized model type {modelConfig.GetType()}");
            }

            SetupAdjacencies(tileModel, tileRotation);
            SetupTiles(tileModel, tileRotation);

            return(tileModel);
        }
Ejemplo n.º 2
0
        public TileModel GetModel(DirectionSet directions, SampleSet sampleSet, TileRotation tileRotation)
        {
            var       samples     = sampleSet.Samples;
            var       modelConfig = Config.Model ?? new Adjacent();
            TileModel tileModel;

            if (modelConfig is Overlapping overlapping)
            {
                var model = new OverlappingModel(overlapping.NX, overlapping.NY, overlapping.NZ);
                foreach (var sample in samples)
                {
                    model.AddSample(sample, tileRotation);
                }
                tileModel = model;
            }
            else if (modelConfig is Adjacent adjacent)
            {
                var model = new AdjacentModel(directions);
                foreach (var sample in samples)
                {
                    model.AddSample(sample, tileRotation);
                }
                tileModel = model;
            }
            else
            {
                throw new ConfigurationException($"Unrecognized model type {modelConfig.GetType()}");
            }

            var autoAdjacencies = Config.AutoAdjacency
                ? AdjacencyUtils.GetAutoAdjacencies(sampleSet, tileRotation, Config.AutoAdjacencyTolerance)
                : new AdjacentModel.Adjacency[0];
            var manualAdjacencies = GetManualAdjacencies(sampleSet.Directions, tileRotation);

            SetupAdjacencies(tileModel, tileRotation, autoAdjacencies.Concat(manualAdjacencies).ToList());
            SetupTiles(tileModel, tileRotation);

            return(tileModel);
        }
Ejemplo n.º 3
0
        private static TileModel GetModel(DeBroglieConfig config, Directions directions, ITopoArray <Tile>[] samples, TileRotation tileRotation)
        {
            var modelConfig = config.Model ?? new Adjacent();

            if (modelConfig is Overlapping overlapping)
            {
                var model = new OverlappingModel(overlapping.NX, overlapping.NY, overlapping.NZ);
                foreach (var sample in samples)
                {
                    model.AddSample(sample, config.RotationalSymmetry, config.ReflectionalSymmetry, tileRotation);
                }
                return(model);
            }
            else if (modelConfig is Adjacent adjacent)
            {
                var model = new AdjacentModel(directions);
                foreach (var sample in samples)
                {
                    model.AddSample(sample, config.RotationalSymmetry, config.ReflectionalSymmetry, tileRotation);
                }
                return(model);
            }
            throw new System.Exception($"Unrecognized model type {modelConfig.GetType()}");
        }