コード例 #1
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);
 }
コード例 #2
0
ファイル: Amoeba.cs プロジェクト: maajor/Physarealm
 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;
 }