@@ -288,6 +288,9 @@ Model::Model(World *world, Model *parent, const std::string &type, const std::st
288288 gui.move = true ;
289289 }
290290
291+ // static size_t count=0;
292+ // printf( "basic %lu\n", ++count );
293+
291294 // now we can add the basic square shape
292295 AddBlockRect (-0.5 , -0.5 , 1.0 , 1.0 , 1.0 );
293296
@@ -376,8 +379,13 @@ void Model::LoadBlock(Worldfile *wf, int entity)
376379
377380void Model::AddBlockRect (meters_t x, meters_t y, meters_t dx, meters_t dy, meters_t dz)
378381{
379- UnMap ();
382+ static size_t count=0 ;
383+ printf ( " abr %lu\n " , ++count );
380384
385+ puts ( " unmap start" );
386+ UnMap ();
387+ puts ( " unmap done" );
388+
381389 std::vector<point_t > pts (4 );
382390 pts[0 ].x = x;
383391 pts[0 ].y = y;
@@ -390,7 +398,9 @@ void Model::AddBlockRect(meters_t x, meters_t y, meters_t dx, meters_t dy, meter
390398
391399 blockgroup.AppendBlock (Block (&blockgroup, pts, Bounds (0 , dz)));
392400
401+ puts ( " map start" );
393402 Map ();
403+ puts ( " map done\n " );
394404}
395405
396406// convert a global pose into the model's local coordinate system
@@ -639,22 +649,19 @@ void Model::AddToPose(const Pose &pose)
639649 AddToPose (pose.x , pose.y , pose.z , pose.a );
640650}
641651
642- bool Model::PlaceInFreeSpace (meters_t xmin, meters_t xmax, meters_t ymin, meters_t ymax,
643- size_t max_iter)
652+
653+ bool Model::RandomPoseInFreeSpace (meters_t xmin, meters_t xmax,
654+ meters_t ymin, meters_t ymax,
655+ size_t max_iter)
644656{
657+ SetPose (Pose::Random (xmin, xmax, ymin, ymax));
658+
645659 size_t i = 0 ;
646660 while (TestCollision () && (max_iter <= 0 || i++ < max_iter))
647661 SetPose (Pose::Random (xmin, xmax, ymin, ymax));
648662 return i <= max_iter; // return true if a free pose was found within max iterations
649663}
650664
651- bool Model::RandomPoseInFreeSpace (meters_t xmin, meters_t xmax, meters_t ymin, meters_t ymax,
652- size_t max_iter)
653- {
654- SetPose (Pose::Random (xmin, xmax, ymin, ymax));
655- return PlaceInFreeSpace (xmin, xmax, ymin, ymax, max_iter);
656- }
657-
658665void Model::AppendTouchingModels (std::set<Model *> &touchers)
659666{
660667 blockgroup.AppendTouchingModels (touchers);
@@ -1363,6 +1370,8 @@ void Model::Load()
13631370
13641371 const Size size (b.x .max - b.x .min , b.y .max - b.y .min , b.z .max - b.z .min );
13651372
1373+ // static size_t count=0;
1374+ // printf( "boundaries %lu\n", ++count );
13661375 AddBlockRect (b.x .min , b.y .min , epsilon, size.y , size.z );
13671376 AddBlockRect (b.x .min , b.y .min , size.x , epsilon, size.z );
13681377 AddBlockRect (b.x .min , b.y .max - epsilon, size.x , epsilon, size.z );
0 commit comments