Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3376 in orxonox.OLD for orxonox/branches/trackManager/src


Ignore:
Timestamp:
Jan 8, 2005, 6:32:39 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/trackManager: c2-continuity-patch (mathematically correct, but does not look to good.)

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

Legend:

Unmodified
Added
Removed
  • orxonox/branches/trackManager/src/curve.cc

    r3375 r3376  
    9494Vector Curve::getNode(unsigned int nodeToFind)
    9595{
    96   if (nodeToFind > this->nodeCount)
     96  if (nodeToFind > this->nodeCount || nodeToFind < 0)
    9797    return Vector(0,0,0);
    9898  PathNode* tmpNode = this->firstNode;
  • orxonox/branches/trackManager/src/track_manager.cc

    r3375 r3376  
    152152{
    153153  this->currentTrackElem->childCount = childCount;
     154  this->currentTrackElem->mainJoin = true;
    154155  this->currentTrackElem->children = new TrackElement*[childCount];
    155156  for (int i=0; i<childCount; i++)
     
    159160      this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->endTime;
    160161      this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem->children[i]);
    161       this->addPoint((this->currentTrackElem->children[i]->curve->getNode(0) *2) - this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()-1),  this->currentTrackElem->children[i]);
    162162    }
    163163}
     
    380380  TrackElement* firstJoint = this->currentTrackElem;
    381381  Vector tmpEndPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount());
    382   Vector tmpTangentPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-1);
     382  Vector tmpTangentPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-1);
     383  Vector tmpc2Point = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-2);
    383384  firstJoint->isJoined = true;
    384   firstJoint->mainJoin = true;
     385  //  firstJoint->mainJoin = true;
    385386  if(!firstJoint->isHotPoint)
    386387    this->setSavePoint();
     
    401402      else
    402403        {
     404          this->addPoint(tmpc2Point, tmpJoinElem);
    403405          this->addPoint(tmpTangentPoint, tmpJoinElem);
    404406          this->addPoint(tmpEndPoint, tmpJoinElem);
     
    421423  this->workOn(tmpCurrentWorkingID);
    422424}
     425
     426/**
     427   \brief finalizes the TrackSystem. after this it will not be editable anymore
     428*/
     429void TrackManager::finalize(void)
     430{
     431  for (int i = 1; i<= trackElemCount ;i++)
     432    {
     433      TrackElement* tmpElem = findTrackElementByID(i);
     434      if (tmpElem->childCount>0 && tmpElem->mainJoin)
     435        {
     436          for (int j = 0; j < tmpElem->childCount; j++)
     437            {
     438             
     439              // c1-continuity
     440              tmpElem->children[j]->curve->addNode(tmpElem->children[j]->curve->getNode(0) +
     441                                                   ((tmpElem->children[j]->curve->getNode(0) -
     442                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1))
     443                                                    ),2);
     444              tmpElem->children[j]->nodeCount++;
     445              // c2-continuity
     446              tmpElem->children[j]->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())-
     447                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) * 4 +
     448                                                   tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-2), 3);
     449              tmpElem->children[j]->nodeCount++;                                                   
     450              printf("accelerations: %d-in: count: %d, %f, %f, %f\n                  %d-out: count: %d %f, %f, %f\n",
     451                     tmpElem->ID, tmpElem->nodeCount,
     452                     tmpElem->curve->calcAcc(0.999).x, tmpElem->curve->calcAcc(0.999).y, tmpElem->curve->calcAcc(0.999).z,
     453                     tmpElem->children[j]->ID, tmpElem->children[j]->nodeCount,
     454                     tmpElem->children[j]->curve->calcAcc(0).x, tmpElem->children[j]->curve->calcAcc(0).y, tmpElem->children[j]->curve->calcAcc(0).z);
     455            }
     456        }
     457    }
     458}
     459
    423460
    424461// RUNTIME //
  • orxonox/branches/trackManager/src/track_manager.h

    r3373 r3376  
    129129  void join(unsigned int count, ...);
    130130  void joinV(unsigned int count, int* trackIDs);
     131  void finalize(void);
    131132
    132133  // Methods to calculate the position on the Path (runtime)
  • orxonox/branches/trackManager/src/world.cc

    r3375 r3376  
    139139void World::destroy()
    140140{
     141  delete trackManager;
    141142}
    142143
     
    228229      trackManager->workOn(10);
    229230      trackManager->addPoint(Vector(250,-10,5));
     231      trackManager->addPoint(Vector(260,-10,5));
     232      trackManager->finalize();
    230233     
    231234      /*
Note: See TracChangeset for help on using the changeset viewer.