Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3354 in orxonox.OLD


Ignore:
Timestamp:
Jan 6, 2005, 12:57:20 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: :TrackManager: now better join is implemented

Location:
orxonox/branches/parenting/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/Makefile.in

    r3353 r3354  
    296296          esac; \
    297297        done; \
    298         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
     298        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
    299299        cd $(top_srcdir) && \
    300           $(AUTOMAKE) --foreign  src/Makefile
     300          $(AUTOMAKE) --gnu  src/Makefile
    301301.PRECIOUS: Makefile
    302302Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/parenting/src/track_manager.cc

    r3352 r3354  
    2929{
    3030  this->isFresh = true;
     31  this->isHotPoint = false;
    3132  this->isSavePoint = false;
    3233  this->isFork = false;
     
    99100
    100101*/
    101 TrackManager::TrackManager ()
     102TrackManager::TrackManager(void)
    102103{
    103104  this->setClassName ("TrackManager");
     
    117118
    118119*/
    119 TrackManager::~TrackManager ()
     120TrackManager::~TrackManager(void)
    120121{
    121122  PRINTF(3)("Destruct TrackManager\n");
     
    180181{
    181182  this->currentTrackElem = findTrackElementByID(trackID);
     183  printf("now Working on %d\n", trackID);
    182184}
    183185
     
    252254int TrackManager::addHotPoint(Vector newPoint)
    253255{
     256  printf("setting up a HotPoint\n");
    254257  if (this->currentTrackElem->isFresh)
    255258    {
     
    261264  this->currentTrackElem->curve->addNode(newPoint);
    262265  this->currentTrackElem->nodeCount++;
     266  this->initChildren(1);
     267  this->currentTrackElem = this->currentTrackElem->children[0];
    263268}
    264269
     
    272277int TrackManager::setSavePoint(void)
    273278{
     279  printf("setting up a SavePoint.\n");
    274280  if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint)
    275281    return this->currentTrackElem->children[1]->ID;
    276282  this->currentTrackElem->isSavePoint = true;
     283  this->currentTrackElem->isHotPoint = true;
    277284
    278285  this->initChildren(1);
     
    312319void TrackManager::forkV(unsigned int count, int* trackIDs)
    313320{
     321  printf("Forking with %d children\n", count);
    314322  if (this->currentTrackElem->isSavePoint)
    315323    return;
    316324  this->currentTrackElem->isFork = true;
     325  this->currentTrackElem->isHotPoint = true;
    317326  for(int i = 0; i < count; i++)
    318327    trackIDs[i]=this->trackElemCount+1+i;
     
    335344
    336345   Join will set the localTime to the longest time a Path has to get to this Point. \n
    337    Join will join all curves to the curve we are working on, meaning that all the tangents will be matched.
     346   Join will join all curves to the first curve, meaning that all the tangents will be matched.
    338347*/
    339348void TrackManager::join(unsigned int count, ...)
     
    360369void TrackManager::joinV(unsigned int count, int* trackIDs)
    361370{
    362   Vector tmpEndPoint = this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount());
    363   Vector tmpTangentPoint = this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()-1);
    364  
    365   for (int i = 0; i < count; i++)
     371  printf("Joining %d tracks to Track %d\n", count, trackIDs[0]);
     372
     373  // chanching work-on to temporary value. going back at the end.
     374  int tmpCurrentWorkingID = this->currentTrackElem->ID;
     375  this->workOn(trackIDs[0]);
     376
     377  TrackElement* firstJoint = this->currentTrackElem;
     378  Vector tmpEndPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount());
     379  Vector tmpTangentPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-1);
     380  firstJoint->isJoined = true;
     381  if(!firstJoint->isHotPoint)
     382    this->setSavePoint();
     383
     384  for (int i = 1; i < count; i++)
    366385    {
    367386      TrackElement* tmpJoinElem = this->findTrackElementByID(trackIDs[i]);
    368       this->addPoint(tmpTangentPoint, tmpJoinElem);
    369       this->addPoint(tmpEndPoint, tmpJoinElem);
    370       tmpJoinElem->isJoined = true;
    371     }
    372   this->currentTrackElem->isJoined = true;
    373 
     387      if (tmpJoinElem->childCount > 0)
     388        printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
     389      else
     390        {
     391          this->addPoint(tmpTangentPoint, tmpJoinElem);
     392          this->addPoint(tmpEndPoint, tmpJoinElem);
     393         
     394          //Copying Joint-Info
     395          tmpJoinElem->children = firstJoint->children;
     396          tmpJoinElem->childCount = firstJoint->childCount;
     397          tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
     398          tmpJoinElem->isFork = firstJoint->isFork;
     399         
     400          tmpJoinElem->isJoined = true;
     401        }
     402    }
     403  // returning to the TrackElement we were working on.
     404  this->workOn(tmpCurrentWorkingID);
    374405}
    375406
     
    477508          if(tmpElem->name)
    478509            printf("name:%s::", tmpElem->name);
     510          if(tmpElem->isFresh)
     511            printf("   has not jet eddited in any way\n");
    479512          printf("\n   TimeTable: starting at = %f; ends at = %f; duration = %f\n", tmpElem->startingTime, tmpElem->startingTime+tmpElem->duration, tmpElem->duration);
    480513          printf("   consists of %d Points\n", tmpElem->nodeCount);
    481 
    482           if(tmpElem->isFresh)
    483             printf("   has not jet eddited in any way\n");
    484           if(tmpElem->isSavePoint)
    485             printf("   is a SavePoint\n");
    486           if(tmpElem->isFork)
     514          if (tmpElem->childCount == 0)
     515            printf("   has no child\n");           
     516          else if (tmpElem->childCount == 1)
     517            printf("   has 1 child: ==%d==\n", tmpElem->children[0]->ID);
     518          else if (tmpElem->childCount > 1)
    487519            {
    488               printf("   is A Fork with with %d children: ", tmpElem->childCount);
     520              printf("   has %d children: ", tmpElem->childCount);
    489521              for(int i = 0; i < tmpElem->childCount; i++)
    490522                printf("=%d= ", tmpElem->children[i]->ID);
    491523              printf("\n");
    492524            }
     525
     526          if(tmpElem->isHotPoint)
     527            printf("   is a special Point:\n");
     528          if(tmpElem->isSavePoint)
     529            printf("    is a SavePoint\n");
     530          if(tmpElem->isFork)
     531            {
     532              printf("    is A Fork with with %d children.", tmpElem->childCount);
     533            }
    493534          if(tmpElem->isJoined)
    494535            printf("   is Joined at the End\n");
    495 
    496                    
    497536        }
    498537    }
  • orxonox/branches/parenting/src/track_manager.h

    r3352 r3354  
    3636
    3737  bool isFresh;              //!< If no Points where added until now
     38  bool isHotPoint;           //!< If the first node is a specialPoint;
    3839  bool isSavePoint;          //!< If the first node is a savePoint
    3940  bool isFork;               //!< If the first node is a Fork
  • orxonox/branches/parenting/src/world.cc

    r3353 r3354  
    246246      int fork11, fork12;
    247247      trackManager->fork(2, &fork11, &fork12);
    248       printf("FORKS: %d, %d\n", fork11, fork12);
    249248      trackManager->workOn(fork11);
    250249      trackManager->addPoint(Vector(170, 0, -15));
     
    255254      trackManager->addPoint(Vector(190,2,5));
    256255      trackManager->addPoint(Vector(200,2,5));
    257       trackManager->join(2, fork11, fork12);
     256      trackManager->setSavePoint();
     257      trackManager->addPoint(Vector(220, 10,-10));
     258      trackManager->addPoint(Vector(230, 0,-10));
     259      trackManager->addPoint(Vector(240, 0, 2));
     260      trackManager->addPoint(Vector(250, 0, 0));
     261      trackManager->join(2, fork12, fork11);
    258262     
    259263      /*
Note: See TracChangeset for help on using the changeset viewer.