Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 //
Note: See TracChangeset for help on using the changeset viewer.