Changeset 638


Ignore:
Timestamp:
12/03/16 03:16:38 (7 years ago)
Author:
sz
Message:

script updated (moveAbs, size_, pos_, center_)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • experiments/frams/foraminifera/data/scripts/foraminifera.expdef

    r595 r638  
    200200                        {
    201201                                // [x,y,energy]
    202                                 cr.move(g.data->genes[0] - cr.center_x, g.data->genes[1] - cr.center_y, 0);
     202                                cr.move(g.data->genes[0] - cr.bboxCenter.x, g.data->genes[1] - cr.bboxCenter.y, 0);
    203203                                cr.energy = g.data->genes[2];
    204204                        }
    205205                        else
    206206                        {
    207                                 cr.move(Math.rnd01 * World.wrldsiz - cr.center_x, Math.rnd01 * World.wrldsiz - cr.center_y, 0);
     207                                cr.move(Math.rnd01 * World.wrldsiz - cr.bboxCenter.x, Math.rnd01 * World.wrldsiz - cr.bboxCenter.y, 0);
    208208                        }
    209209                }
     
    224224
    225225        for(var cr in Populations[1])
    226                 tmpvec.add([cr.center_x, cr.center_y, cr.energy]);
     226                tmpvec.add([cr.bboxCenter.x, cr.bboxCenter.y, cr.energy]);
    227227
    228228        ExpState.nutrient = tmpvec;
     
    400400                cr.data->reticulopodiacreature = ret;
    401401                ret.getMechPart(0).orient.set(cr.getMechPart(0).orient);
    402                 ret.moveAbs(cr.center_x-radius, cr.center_y-radius, cr.center_z-radius);
     402                ret.locationSetBboxLow(cr.bboxCenter.x-radius, cr.bboxCenter.y-radius, cr.bboxCenter.z-radius);
    403403}
    404404
     
    421421                if (!cr.boundingBoxCollisions(0))
    422422                {
    423                         cr.moveAbs(cr.pos_x, cr.pos_y, -cr.getPart(cr.numparts-1).sx); //place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)
     423                        cr.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y, -cr.getPart(cr.numparts-1).sx); //place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)
    424424                        return cr;
    425425                }
     
    463463
    464464                setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : "growth", "energy0" : cr.energy0});
    465                 cr2.moveAbs(cr.pos_x, cr.pos_y,cr.pos_z);
     465                cr2.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y,cr.bboxLow.z);
    466466                setForamMeta(cr2);
    467467
     
    516516function stepToNearest(cr)
    517517{
    518         var p = XYZ.new(cr.center_x, cr.center_y, cr.center_z);
     518        var p = XYZ.new(cr.bboxCenter.x, cr.bboxCenter.y, cr.bboxCenter.z);
    519519        var n = cr.signals.receiveSet("nutrient", getZoneRange(cr,2));
    520520
     
    532532                for (i = 0; i < n.size; i++)
    533533                {
    534                         mp = XYZ.new(n[i].value.center_x, n[i].value.center_y, n[i].value.center_z);
     534                        mp = XYZ.new(n[i].value.bboxCenter.x, n[i].value.bboxCenter.y, n[i].value.bboxCenter.z);
    535535                        distvec.set(mp);
    536536                        distvec.sub(p);
     
    597597        //Prevents forams from crossing the world border. In the case of touching the border with the reticulopodia direction of the movement should be changed.
    598598        var change_direction = 0;
    599         var new_x = fence(cr.center_x, getZoneRange(cr, 1));
    600         var new_y = fence(cr.center_y, getZoneRange(cr, 1));
    601 
    602         if ((new_x != cr.center_x) || (new_y != cr.center_y) || (cr.data->lifeparams->dir_counter >= int(secToSimSteps(ExpProperties.dir_change_sec))))
     599        var new_x = fence(cr.bboxCenter.x, getZoneRange(cr, 1));
     600        var new_y = fence(cr.bboxCenter.y, getZoneRange(cr, 1));
     601
     602        if ((new_x != cr.bboxCenter.x) || (new_y != cr.bboxCenter.y) || (cr.data->lifeparams->dir_counter >= int(secToSimSteps(ExpProperties.dir_change_sec))))
    603603        {
    604604                change_direction = 1;
    605                 cr.moveAbs(new_x-cr.size_x/2, new_y-cr.size_y/2, -cr.getPart(cr.numparts-1).sx);//place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)
     605                cr.locationSetBboxLow(new_x-cr.bboxSize.x/2, new_y-cr.bboxSize.y/2, -cr.getPart(cr.numparts-1).sx);//place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)
    606606        }
    607607
     
    631631        if (visualization(cr))
    632632        {
    633                 cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1));
     633                cr.data->reticulopodiacreature.locationSetBboxLow(cr.bboxCenter.x-getZoneRange(cr,1), cr.bboxCenter.y-getZoneRange(cr,1), cr.bboxCenter.z-getZoneRange(cr,1));
    634634                cr.data->reticulopodiacreature.drive = cr.drive;
    635635        }
     
    779779function onNutrientsStep(cr)
    780780{
    781         cr.moveAbs(cr.pos_x % World.wrldsiz, cr.pos_y % World.wrldsiz, 0.5);
     781        cr.locationSetBboxLow(cr.bboxLow.x % World.wrldsiz, cr.bboxLow.y % World.wrldsiz, 0.5);
    782782}
    783783
     
    800800                var nut = Populations[2].add("//0\nm:Vstyle=nutrient_visual\np:sh=2,sx="+nutsize+",sy="+nutsize+",sz="+nutsize+",ry=1.5,vr=0.0,1.0,0.0");
    801801                cr.data->reticulopodiacreature = nut;
    802                 nut.moveAbs( cr.pos_x+cr.size_x/2-nut.size_x/2,  cr.pos_y+cr.size_y/2-nut.size_y/2, -nutsize);
     802                nut.locationSetBboxLow( cr.bboxLow.x+cr.bboxSize.x/2-nut.bboxSize.x/2,  cr.bboxLow.y+cr.bboxSize.y/2-nut.bboxSize.y/2, -nutsize);
    803803        }
    804804}
Note: See TracChangeset for help on using the changeset viewer.