Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            resize = new FxVector2f(targetRes.x / (float)origRes.x, targetRes.y / (float)origRes.y);

            // create a shop
            shopPlan = FxMatrixF.Load("Katopsi.jpg", ColorSpace.Grayscale);
            shopPlan = shopPlan.Resize(targetRes.x, targetRes.y);
            shop = new Shop("Unisol", shopPlan);

               // simulation = new SimulationSimple(shop, 10, simulationMethod1);

            simulationMethod2_Setup();
            simulation = new SimulationSimple(shop, 1, simulationMethod2);

            // Defind entrance for the shop
            shop.entrancePositionsDirection.Add(new Tuple<FxVector2f, FxVector2f>(new FxVector2f(1800 * resize.x, 500 * resize.y), new FxVector2f(-1, 0)));

            // load a person image for the moving image
            imPerson = FxMatrixF.Load("person.jpg", ColorSpace.Grayscale);
               // imPerson.Exec(x => (x > 0.1) ? 0 : 1);
            imPerson.MedianFilt();
            imPersonMask = imPerson < 0.5f;

            // Init the matrix to be HD
            mat = new FxMatrixF(targetRes.x, targetRes.y);
            mat.DrawMatrix(shopPlan, new FxVector2f(0, 0), new FxVector2f(mat.Width, mat.Height), FxMatrixF.DrawInterpolationMethod.NearestNeighbor);

            // Add image element to canvas to showing the matrix
            im = new ImageElement(mat);
            canvas1.AddElement(im, true);
        }
Exemplo n.º 2
0
 public SimulationSimple(Shop shop, int numPeople, Action<List<Person>> peopleSimulation)
 {
     this.shop = shop;
     this._numPeople = numPeople;
     this.peopleSimulation = peopleSimulation;
 }