public override void Clear()
 {
     uv_positions.Initialize();
     trail.Initialize();
     griddata.Initialize();
     temptrail.Initialize();
     particle_ids.Initialize();
     agedata.Initialize();
     //_origins.Clear();
 }
示例#2
0
 public Matcher(int bitmapWidth, int bitmapHeight, int angleStep)
 {
     this.bitmapHeight = bitmapHeight;
     this.bitmapWidth  = bitmapWidth;
     sizeX             = (bitmapWidth * 2);  // -1
     sizeY             = (bitmapHeight * 2); // -1
     angleCount        = InitAngleArray(angleStep);
     accumulator       = new int[sizeX, sizeY, angleCount];
     accumulator.Initialize();
 }
        public void CalculateH3D(int y, int x)
        {
            H3D = new int[2, 256, 256];
            H3D.Initialize();

            for (int i = 0; i < y - 1; i++)
            {
                for (int j = 0; j < x - 1; j++)
                {
                    H3D[0, Grey[i, j], Grey[i, j + 1]]++;
                    H3D[0, Grey[i, j], Grey[i + 1, j]]++;

                    H3D[1, Grey[i, j], Grey[i, j + 1]] = Grey[i, j + 1];
                    H3D[1, Grey[i, j], Grey[i + 1, j]] = Grey[i + 1, j];
                }
            }
        }
示例#4
0
    /// <summary>
    /// Takes a Point3 in data coordinates.
    /// </summary>
    public Pathfinding(MazeStructure maze, bool[, ,] walls, Point3 center)
    {
        // initialize member variables
        this.center = center;
        this.maze   = maze;
        //Debug.Log(center);
        data = new int[walls.GetLength(0), walls.GetLength(1), walls.GetLength(2)];
        data.Initialize();

        // create visited matrix
        bool[, ,] visited = new bool[walls.GetLength(0), walls.GetLength(1), walls.GetLength(2)];
        visited.Initialize();

        // initialize vars
        Queue <VisitPoint> toVisit = new Queue <VisitPoint>(walls.GetLength(0) * walls.GetLength(1));

        toVisit.Enqueue(new VisitPoint(center, 0));

        // visit every possible cell
        while (toVisit.Count > 0)
        {
            // visit the given cell
            int    value = toVisit.Peek().value;
            Point3 pos   = toVisit.Dequeue().pos;
            data[pos.x, pos.y, pos.z]    = value;
            visited[pos.x, pos.y, pos.z] = true;

            // add appropriate neighbors to toVisit
            Point3[] neighbors = Point3.Scramble(pos.neighbors(2));
            foreach (Point3 newPos in neighbors)
            {
                if (maze.ValidMove(pos, newPos) && (!visited[newPos.x, newPos.y, newPos.z]))
                {
                    toVisit.Enqueue(new VisitPoint(newPos, value + 1));
                }
            }
        }
    }