Пример #1
0
        public bool initializeAmoeba(double x, double y, double z, int radius, AbstractEnvironmentType env, Libutility util)
        {
            int     try_count    = 0;
            Point3d IniIndexLoca = env.getIndexByPosition(x, y, z);
            int     start_x      = (int)IniIndexLoca.X - radius > 0 ? (int)IniIndexLoca.X - radius : 0;
            int     start_y      = (int)IniIndexLoca.Y - radius > 0 ? (int)IniIndexLoca.Y - radius : 0;
            int     start_z      = (int)IniIndexLoca.Z - radius > 0 ? (int)IniIndexLoca.Z - radius : 0;
            int     end_x        = (int)IniIndexLoca.X + radius < env.u ? (int)IniIndexLoca.X + radius : env.u - 1;
            int     end_y        = (int)IniIndexLoca.Y + radius < env.v ? (int)IniIndexLoca.Y + radius : env.v - 1;
            int     end_z        = (int)IniIndexLoca.Z + radius < env.w ? (int)IniIndexLoca.Z + radius : env.w - 1;

            do
            {
                tempx = util.getRand(start_x, end_x + 1);
                tempy = util.getRand(start_y, end_y + 1);
                tempz = util.getRand(start_z, end_z + 1);
                try_count++;
            }while (!iniSuccess(tempx, tempy, tempz, env, util) && try_count < 10);
            curx = tempx;
            cury = tempy;
            curz = tempz;
            //Location = new Point3d(curx, cury, curz);
            Location = env.getPositionByIndex(curx, cury, curz);
            occupyCell(curx, cury, curz, env);
            selectRandomDirection(env, util);
            prev_loc = new Point3d(x, y, z);
            return(true);
        }
Пример #2
0
 public void resetFloatingPointPosition(AbstractEnvironmentType env)
 {
     Location = env.getPositionByIndex(curx, cury, curz);
     //tempfloatx = curx;
     //tempfloaty = cury;
     //tempfloatz = curz;
     //Location = new Point3d(curx, cury, curz);
     return;
 }
Пример #3
0
        public bool initializeAmoeba(double x, double y, double z, AbstractEnvironmentType env, Libutility util)
        {
            Point3d indexLoca = env.getIndexByPosition(x, y, z);

            tempx = (int)indexLoca.X;
            tempy = (int)indexLoca.Y;
            tempz = (int)indexLoca.Z;
            curx  = tempx;
            cury  = tempy;
            curz  = tempz;
            //Location = new Point3d(curx, cury, curz);
            Location = env.getPositionByIndex(curx, cury, curz);
            occupyCell(curx, cury, curz, env);
            selectRandomDirection(env, util);
            prev_loc = Location;
            return(true);
        }
Пример #4
0
 public bool initializeAmoeba(AbstractEnvironmentType env, Libutility util)
 {
     do
     {
         tempfloatx = (float)util.getDoubleRand(env.getUMin(), env.getUMax());
         tempfloaty = (float)util.getDoubleRand(env.getVMin(), env.getVMax());
         tempfloatz = (float)util.getDoubleRand(env.getWMin(), env.getWMax());
         Point3d indexPos = env.getIndexByPosition(tempfloatx, tempfloaty, tempfloatz);
         tempx = (int)indexPos.X;
         tempy = (int)indexPos.Y;
         tempz = (int)indexPos.Z;
     }while (!iniSuccess(tempx, tempy, tempz, env, util));
     curx = tempx;
     cury = tempy;
     curz = tempz;
     //Location = new Point3d(curx, cury, curz);
     Location = env.getPositionByIndex(curx, cury, curz);
     occupyCell(curx, cury, curz, env);
     selectRandomDirection(env, util);
     prev_loc = Location;
     return(true);
 }
Пример #5
0
 public void resetFloatingPointPosition(AbstractEnvironmentType env)
 {
     Location = env.getPositionByIndex(curx, cury, curz);
     //tempfloatx = curx;
     //tempfloaty = cury;
     //tempfloatz = curz;
     //Location = new Point3d(curx, cury, curz);
     return;
 }
Пример #6
0
 public bool initializeAmoeba(double x, double y, double z,  int radius, AbstractEnvironmentType env, Libutility util)
 {
     int try_count = 0;
     Point3d IniIndexLoca = env.getIndexByPosition(x, y, z);
     int start_x = (int)IniIndexLoca.X - radius > 0 ? (int)IniIndexLoca.X - radius : 0;
     int start_y = (int)IniIndexLoca.Y - radius > 0 ? (int)IniIndexLoca.Y - radius : 0;
     int start_z = (int)IniIndexLoca.Z - radius > 0 ? (int)IniIndexLoca.Z - radius : 0;
     int end_x = (int)IniIndexLoca.X + radius < env.u ? (int)IniIndexLoca.X + radius : env.u - 1;
     int end_y = (int)IniIndexLoca.Y + radius < env.v ? (int)IniIndexLoca.Y + radius : env.v - 1;
     int end_z = (int)IniIndexLoca.Z + radius < env.w ? (int)IniIndexLoca.Z + radius : env.w - 1;
     do
     {
         tempx = util.getRand(start_x, end_x + 1);
         tempy = util.getRand(start_y, end_y + 1);
         tempz = util.getRand(start_z, end_z + 1);
         try_count++;
     }
     while (!iniSuccess(tempx, tempy, tempz, env, util) && try_count<10);
     curx = tempx;
     cury = tempy;
     curz = tempz;
     //Location = new Point3d(curx, cury, curz);
     Location = env.getPositionByIndex(curx, cury, curz);
     occupyCell(curx, cury, curz, env);
     selectRandomDirection(env, util);
     prev_loc = new Point3d(x, y, z);
     return true;
 }
Пример #7
0
 public bool initializeAmoeba(double x, double y, double z, AbstractEnvironmentType env, Libutility util)
 {
     Point3d indexLoca = env.getIndexByPosition(x, y, z);
     tempx = (int)indexLoca.X;
     tempy = (int)indexLoca.Y;
     tempz = (int)indexLoca.Z;
     curx = tempx;
     cury = tempy;
     curz = tempz;
     //Location = new Point3d(curx, cury, curz);
     Location = env.getPositionByIndex(curx, cury, curz);
     occupyCell(curx, cury, curz, env);
     selectRandomDirection(env, util);
     prev_loc = Location;
     return true;
 }
Пример #8
0
 public bool initializeAmoeba(AbstractEnvironmentType env, Libutility util)
 {
     do
     {
         tempfloatx = (float)util.getDoubleRand(env.getUMin(), env.getUMax());
         tempfloaty = (float)util.getDoubleRand(env.getVMin(), env.getVMax());
         tempfloatz = (float)util.getDoubleRand(env.getWMin(), env.getWMax());
         Point3d indexPos = env.getIndexByPosition(tempfloatx, tempfloaty, tempfloatz);
         tempx = (int)indexPos.X;
         tempy = (int)indexPos.Y;
         tempz = (int)indexPos.Z;
     }
     while (!iniSuccess(tempx, tempy, tempz, env, util));
     curx = tempx;
     cury = tempy;
     curz = tempz;
     //Location = new Point3d(curx, cury, curz);
     Location = env.getPositionByIndex(curx, cury, curz);
     occupyCell(curx, cury, curz, env);
     selectRandomDirection(env, util);
     prev_loc = Location;
     return true;
 }